[CMake] per configuration settings

Brad King brad.king at kitware.com
Wed Oct 20 17:38:20 EDT 2004


Clinton Stimpson wrote:

> 
> On windows, I have some 3rd party libraries where I have a set of 
> release libraries and a set of debug libraries.  The .lib files are in 
> different directories.
> 
> How do I tell CMake that my debug libraries are in one directory and my 
> release ones in another directory?  I'm generating windows project files.

cmake --help-command TARGET_LINK_LIBRARIES

will show you how to do this.  Basically you just specify a separate 
library for each:

TARGET_LINK_LIBRARIES(myexe ... debug third_debug optimized third_opt)

> Also, how do I tell CMake to add a certain preprocessor define for a 
> release build and a different one for a debug build?

I do not think there is a cross-platform way to do this right now. 
However, "NDEBUG" is defined for all release builds and not defined for 
debug builds on all platforms.  You can use this in a header file to 
define/undefine whatever macros you want.

-Brad



More information about the CMake mailing list