Search code examples
cmakeclang-complete

.clang_complete and CMake?


I'm using CMake to genenerate my Makefile's however I cannot generate the .clang_complete using the standard

make CC='~/.vim/bin/cc_args.py gcc' CXX='~/.vim/bin/cc_args.py g++' -B

nothing gets generated...

the tree structure looks like so

Root
 |
 |_core
 |  |_src
 |  |  |_main.cpp
 |  |  |_CMakeLists.txt (1)
 |  |_inc
 |  |_CMakeLists.txt (2)
 |
 |_lib
 |  |_rtaudio
 |
 |_CMakeLists.txt (3)

CMakeLists.txt (1) file:

 include_directories("${Dunkel_SOURCE_DIR}/core/inc")

include_directories("${Dunkel_SOURCE_DIR}/lib/")
link_directories("${Dunkel_SOURCE_DIR}/lib/rtaudio")

add_executable(Dunkel main.cpp)

target_link_libraries(Dunkel rtaudio)

CMakeLists.txt (2) file:

subdirs(src)

CMakeLists.txt (3) file:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(Dunkel)
SUBDIRS(core)

set(CMAKE_CXX_FLAGS "-g")

What am I doing wrong here?


Solution

  • Looks like contrary to make cmake doesn't expand tilde, hence it treats is as part of the path. To make it work as expected either use absolute path to the cc_args.py script or do two simple changes in the command:

    1. Replace the tilde with $HOME.
    2. Replace single quotes with double quotes.

    After the changes your command should look like this:

    CXX="$HOME/.vim/bin/cc_args.py g++" cmake ..
    

    And it should work.