[CMake] Remove compilation flags for a given target

Marc Herbert marc.herbert at gmail.com
Fri Apr 5 22:56:25 EDT 2019


>
>
> in our code base we would like to add a warning compilation flags.
> Nevertheless, this flag prevents us from compiling a few targets so we
> would like to remove this flag for the given targets.
>
> Since I don't want to *add* a compilation flags but remove one, I would
> like to retrieve the properties of the target
> (get_target_property(my_compilation_flags TARGET COMPILE_FLAGS)), and
> then modify those and use it to set the properties of the target.
>

Instead of removing, have you tried appending the -Wno-fubar flag that
turns back off these
specific warnings for these specific files?

With gcc for instance:
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
"Each of these specific warning options also has a negative form beginning
‘-Wno-’
to turn off warnings; for example, -Wno-implicit. [...] For options of the
same specificity,
the last one takes effect"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190405/70b7f9a8/attachment.html>


More information about the CMake mailing list