Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.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?

like image 893
Pepe Avatar asked Jan 28 '13 23:01

Pepe


2 Answers

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.

like image 139
xaizek Avatar answered Nov 15 '22 07:11

xaizek


You should run (in your build directory)

CXX='~/.vim/bin/cc_args.py g++' cmake ..

and then run make as usual. Note that this will run the cc_args.py script every time you build the project with make, if you want to disable this, re-run cmake again.

The file .clang_complete will be created in the build directory, move it if needed.

See also Vim: Creating .clang_complete using CMake

like image 21
Guy Avatar answered Nov 15 '22 08:11

Guy