[CMake] How to query compiler definitions?

SF Markus Elfring elfring at users.sourceforge.net
Wed Jan 19 03:30:11 EST 2011


Hello,

I know that some source code will only be needed in my example project if the 
preprocessor symbol "NDEBUG" is not defined.
This is usual for conditional compilation. The corresponding bit of debug code 
calls functions which are implemented in a few other source files.
Now I am looking for ways whether these files can be added on demand to the 
build process.

I try to query the settings by a programming interface from CMake 2.8.3 on my 
openSUSE 11.3 system.

get_directory_property(info COMPILE_DEFINITIONS)
message(STATUS "info: ${info}")

The corresponding display indicates that this variable is empty. I guess that 
this fact should be interpreted also in the way that the specified property is 
not defined in my situation.
Now I wonder why this approach does not work as expected. (A few definitions are 
passed to my compiler of course.)

I would appreciate your advices.

Regards,
Markus


More information about the CMake mailing list