[CMake] Make CMAKE_EXPORT_COMPILE_COMMANDS not default?
Martin Zenzes
martin.zenzes at dfki.de
Mon Dec 2 09:55:15 EST 2013
Hi,
is there a reason why the cmake-option "CMAKE_EXPORT_COMPILE_COMMANDS"
is not enabled by default? It was exposed as an option in 2011 [1], a
few days after adding it initially. It can be enabled manually by adding
"set(CMAKE_EXPORT_COMPILE_COMMANDS ON)" into the CMakeLists.txt or
giving the option on the commandline as in "mkdir -p build && cd build
&& cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=on"
The option generates a file "compile_commands.json", containing the
exact calls for all translation units of the project in machine-readable
form. Benefits:
- easier debugging of build process. Not always necessary to search
manually in the output of `make -B VERBOSE=1|less`, instead go directly
to the compile_commands.json
- allows using this file for code-completion tools like clang_complete
[2] or YouCompleteMe [3]in projects out of the box
The file is only generated for UnixMakefiles and the Ninja buildsystem.
Greetings
[1]
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5674844de4b74d0b66cfc6b8237e631702c43637
[2] https://github.com/Rip-Rip/clang_complete
[3] https://github.com/Valloric/YouCompleteMe
More information about the CMake
mailing list