Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake supress warnings on external library

I'm using GLAD on my project, and building everything with cmake.

Since this is an external library and not my code, I'd like to completely suppress its warnings during build time, because I get a ton of these:

warning: ISO C forbids conversion of object pointer to function pointer type [-Wpedantic]
 glad_glCullFace = ( PFNGLCULLFACEPROC ) load ( "glCullFace" );
                   ^

How can I do it? I can either just include it in my sources, or do an add_library with GLAD's sources, don't mind either way.

Thanks

like image 230
Joao Pincho Avatar asked Mar 10 '17 22:03

Joao Pincho


People also ask

How do you stop warnings in Cmake?

Use -Wno-dev to suppress it. You can disable the warning like this when you are configuring your build.

How do I turn off warnings in GCC?

To suppress this warning use the unused attribute (see Variable Attributes). This warning is also enabled by -Wunused , which is enabled by -Wall . Warn whenever a static function is declared but not defined or a non-inline static function is unused.


1 Answers

Use the SYSTEM keyword to avoid warnings from system libraries like so:

target_include_directories(target SYSTEM GLAD)
like image 66
DrumM Avatar answered Oct 28 '22 07:10

DrumM