[CMake] linux debugging flags

Brad King brad.king at kitware.com
Thu May 25 10:08:28 EDT 2006


frederic heem wrote:
> The pwlib library has recently changed its linux debug flags to -g3 -ggdb -O0, 
> it is believed that it makes debugging easier, is there a way to integrate it 
> into cmake ?

What do you mean by "integrate it into cmake"?

If you want to build a project with these flags just edit the 
CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG entries to have them and 
then set the CMAKE_BUILD_TYPE entry to Debug.

If you want to override the CMake default for yor project you can write

SET(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/User.cmake)
PROJECT(FOO C)

at the top of the project and then put the code

SET(CMAKE_C_FLAGS_DEBUG "-g3 -ggdb -O0" CACHE STRING "Debug options.")

in User.cmake.

-Brad


More information about the CMake mailing list