[CMake] Append an option to CMAKE_C_FLAGS_DEBUG

Mathieu Dubois mathieu.dubois at limsi.fr
Tue Apr 20 04:31:25 EDT 2010


Hello,

I'm a new CMake user under Linux and I like it.

I have a simple question concerning CMAKE_C_FLAGS_DEBUG.

I have made a library and I would like it to print more information when 
compiled when CMAKE_BUILD_TYPE=Debug.
I think that the best way is to define a DEBUG preprocessor variable and 
modify CMAKE_C_FLAGS_DEBUG.

The problem is that CMake sets CMAKE_C_FLAGS_DEBUG to "-g" which is 
mandatory.

My question is: how can I "append" the option "-DDEBUG" to the 
CMAKE_C_FLAGS_DEBUG variable?

I have tried
set (CMAKE_C_FLAGS_DEBUG "-DDEBUG" ${CMAKE_C_FLAGS_DEBUG})
without effect.

Thanks in advance,
Mathieu


More information about the CMake mailing list