On 01/19/2011 09:50 AM, SF Markus Elfring wrote: >> Why don't you include the check for NDEBUG in in your "debug-sources"? > > This is the case already. > > >> The time you'll waste compiling these files will be negligible, and it >> would work with mult-config IDE's. > > I find this view debatable. I would appreciate if I can express in the > build specification that a few source file are optional for the > compilation because of this well-known preprocessor symbol. > > Regards, > Markus
But that's exactly the problem. For multi-config IDE's you *don't know* whether NDEBUG is defined or not at CMake-time. And AFAIK there's no way to specify that a source file is conditional on the build configuration. The only other way I can see how to handle this, is to create a static library (say debug_funcs) and then link that conditionally. E.g: ----------<8---------- add_library(debug_funcs STATIC EXCLUDE_FROM_ALL debug_funcs.c) add_executable(super super.c) target_link_libraries(super debug debug_funcs) ----------<8---------- This way, as I understand it, debug_funcs will only be built if the executable super links against it, which it only does for the Debug configuration. 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