[CMake] how can I filter compiler warnings?

Hendrik Sattler post at hendrik-sattler.de
Mon May 10 14:39:59 EDT 2010


Am Montag 10 Mai 2010, 19:15:05 schrieb Kevin Burge:
> The trick is I want the compiler to issue the warnings I need to filter for
> *my* code, but I want them suppressed for the third party libraries we use
> (particularly their headers).  So, what we do is specifically filter the
> warning for things we didn't write, but fix them in our code.  You don't
> want to disable the warning, because then you will not find those kinds of
> problems in your own code.  If I could make all third-party warnings
> disappear when compiling my object files, on all platforms, that'd be
> great, but I don't think such a filter exists, so, we're left shooting
> them down one by one.  If cmake cause make/nmake to pipe the output
> through some filter, that would allow me to pick and choose what to
> suppress.  I figure the cmake has to be doing this somewhere, since it
> colorizes the output.  I just want to hook into this somehow and clean up
> some of the lines myself, if that's possible.

This is easy for gcc: use include(SYSTEM ...) instead of include(). May also 
work for the other compilers. For gcc, this uses -isystem instead of -I.

HS


More information about the CMake mailing list