[CMake] selecting different libraries for different configuration types?

Roger Dannenberg rbd at cs.cmu.edu
Mon Nov 2 18:32:19 EST 2009


Thanks -- just what I needed.

Now that library selection is working, I'm having problems with library 
generation: I'm generating two versions of a C library (static and 
dynamic) and I want to control the C Runtime Library selection for the 
debug and release version of each. I tried for example

set_target_properties(mylib-static PROPERTIES CMAKE_C_FLAGS_DEBUG "/MTd")

but the general CMAKE_C_FLAGS_DEBUG variable seems to be determining the 
compiler flags. I can control the flags with CMAKE_C_FLAGS_DEBUG and 
CMAKE_C_FLAGS_RELEASE, but then I get the same flags on both static and 
dynamic versions of the library.

-Roger

Tyler Roscoe wrote:
> On Mon, Nov 02, 2009 at 09:48:35AM -0500, Roger Dannenberg wrote:
>   
>> Is it possible for cmake to create VisualStudio projects that have a 
>> different set of libraries ("AdditionalDependencies") for each 
>> configuration type?
>>     
>
> Look at the debug/optimized flags to target_link_libraries().
>
> tyler
>
>   



More information about the CMake mailing list