[CMake] set_source_files_properties per configuration

J Decker d3ck0r at gmail.com
Mon Mar 22 21:15:28 EDT 2010


On Mon, Mar 22, 2010 at 3:58 PM, Tyler Roscoe <tyler at cryptio.net> wrote:
> On Mon, Mar 22, 2010 at 06:40:21PM -0400, Simmons, Aaron wrote:
>>         if (CMAKE_BUILD_TYPE STREQUAL Debug)
>>             set_source_files_properties( myfile.cpp PROPERTIES COMPILE_FLAGS -DMYFLAG=asdf )
>>         endif (CMAKE_BUILD_TYPE STREQUAL Debug)
>>
>> However, for multi-configuration build types (msvc, xcode) I can't use
>> CMAKE_BUILD_TYPE.  In fact, I'm not sure what function to use here.  I
>
> Well, there's this:
>
> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_sf:COMPILE_DEFINITIONS_CONFIG
>
> I think someone else (J Decker?) recently commented on the lack of a
> per-config compiler flag property. Search the archives; I don't remember
> the resolution or whether someone produced a workaround.
>

Actually that was more like per-target type flags... but

CMAKE_BUILD_TYPE   - this should be consistant between all generators,
no?  why is this not a good thing to test for?  Oh I see, cause like
MSVC you really need to flags built for all CMAKE_BUILD_TYPES at once
into the projects.

But, using CMake, you can't really just change the bulid type in
visual studio to another configuration, really you should regenerate
the project using cmake to change th build type.  oh - that's pretty
funny, all the default types of project are in a visual studio
project... and the options specified in the generator .cmake file are
changed... Hmm, but you're saying that the build type isn't actually
cycled during generation to get per-dependancy options....




> tyler
> _______________________________________________
> 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
>


More information about the CMake mailing list