[CMake] No <LANG>_FLAGS_<CONFIG> target property.

Hendrik Sattler post at hendrik-sattler.de
Mon Mar 14 16:19:43 EDT 2011


Am Montag 14 März 2011, 16:35:21 schrieb Óscar Fuentes:
> Hendrik Sattler <post at hendrik-sattler.de>
> 
> writes:
> > Zitat von Óscar Fuentes <ofv at wanadoo.es>:
> >> There are target properties such as LINK_FLAGS and LINK_FLAGS_<CONFIG>,
> >> but I don't see properties for setting compiler flags. This makes
> >> impossible to build two targets on the same CMakeLists.txt with
> >> different compiler flags (I was told that the last value of
> >> CMAKE_<LANG>_FLAGS_<CONFIG> applies to all targets on that
> >> CMakeLists.txt).
> >> 
> >> So why no per-target compile flags?
> > 
> > RTFM? The following line is directly derived from the words in your
> > question: set_target_properties(myTarget PROPERTIES COMPILE_FLAGS "-foo
> > -bar")
> > 
> > Or maybe your question was wrong?
> 
> "The COMPILE_FLAGS property sets additional compiler flags used to build
> sources within the target."
> 
> So it *adds* flags. I want to *set* flags, i.e. replace the existing
> ones.

So you add global compiler flags which are not meant to be global? A usual 
person would say: "then do not set them globally!".
It's really that simple...

HS


More information about the CMake mailing list