Use COMPILE_FLAGS target property. Like this: set_target_properties(Exec2 PROPERTIES COMPILE_FLAGS "/flag1 /flag2")
You can see full list of properties in CMake documentation. Note that compiler flags may be also set for particular source file with set_source_files_properties command. On Thu, Mar 24, 2011 at 5:44 PM, David Doria <daviddo...@gmail.com> wrote: > Is there a way to explicitly set the CMAKE_CXX_FLAGS for a particular > executable? That is, if I set CMAKE_CXX_FLAGS and then have a > add_executable line, then change CMAKE_CXX_FLAGS and then have another > add_executable, will the first set of CMAKE_CXX_FLAGS be applied to > the first executable and the second set of CMAKE_CXX_FLAGS be applied > to the second executable? > > I guess my confusion is that I don't understand how CMake variables are > cached. > > Each time I modify the variable, should I do it using > > SET(CMAKE_CXX_FLAGS "some flags") > > or > > SET(CMAKE_CXX_FLAGS "some flags" CACHE STRING "compiler flags") > > ? > > In this example: http://codepad.org/PGJRBjss the messages are actually > not displayed at all, which is only adding to my confusion :) > > Any comments on this? > > Thanks, > > David > _______________________________________________ > 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 >
_______________________________________________ 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