Joao Pincho
Joao Pincho

Reputation: 979

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

Upvotes: 16

Views: 16731

Answers (1)

jaques-sam
jaques-sam

Reputation: 2825

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

target_include_directories(target SYSTEM GLAD)

Upvotes: 5

Related Questions