[CMake] COMPILE_FLAGS_<CONFIG>

Will Dicharry wdicharry at stellarscience.com
Tue Oct 20 11:36:31 EDT 2009


Steven Wilson wrote:
> I am asking why CMake doesn't support the following:
> 
> set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS_<CONFIG>
> "-fmyflag")
> 

Ah...I see now, sorry for misunderstanding.  That would indeed be a 
useful feature, much like how you can set flags for different variants 
in Boost.Build.

With generators that don't support configuration types, you can hack 
your way around it with if statements:

if( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
   set_target_properties(...)

but that's kind of a crummy solution and won't work with the VS 
generator.  I would also be curious to find a solution to your problem.

> 
>     Would set_target_properties() work?  Then you can do something like:
> 
>     set_target_properties( ${TARGET} PROPERTIES COMPILE_FLAGS "-fmyflag" )
> 
>     to set compile flags on a target by target basis.
> 
> 


-- 
Will Dicharry
Software Developer
Stellar Science Ltd Co
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3344 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091020/7c7c7689/attachment.bin>


More information about the CMake mailing list