On 01/19/2011 09:30 AM, SF Markus Elfring wrote: > 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
The NDEBUG flag is "special" and gets set by CMake for non-debug builds automagically. Also, such an approach as you propose would work for Makefile generators, but would completely fail for multi-config IDE generators, such as Xcode or VisualStudio. Why don't you include the check for NDEBUG in in your "debug-sources"? Like this: debug-functions.c: ----------<8---------- #ifndef NDEBUG void some_debug_function(void) { /* whathever */ } #endif ----------<8---------- The time you'll waste compiling these files will be negligible, and it would work with mult-config IDE's. Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake