[CMake] selecting different libraries for different configuration types?

Roger Dannenberg rbd at cs.cmu.edu
Mon Nov 2 19:36:27 EST 2009


Tyler Roscoe wrote:
> On Mon, Nov 02, 2009 at 06:32:19PM -0500, Roger Dannenberg wrote:
>   
>> 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.
>>     
>
> Right idea, wrong property. I think it's COMPILE_FLAGS_<config> but
> check the docs.
>
> tyler
>   
Thanks again. COMPILE_FLAGS seems to pass target-specific flags and 
overrides CMAKE_C_FLAGS_<config>, but COMPILE_FLAGS_<config> doesn't do 
anything. I looked at the code in cmLocalVisualStudio7Generator.cxx and 
found where it adds COMPILE_FLAGS, but I don't see anything that would 
support flags that are both configuration-specific and target-specific. 
I hope I'm missing something. Any other ideas?



More information about the CMake mailing list