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
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake