CMake 3.25 added the SYSTEM directory property one can add to add_subdirectory()
and FetchContent_Declare
and the SYSTEM target property.
I use a library that has a conflicting compilation flag standard leading to a multitude of warnings leaking from the headers. I would like to emulate or reproduce the directory SYSTEM
property. Or at least, silence the warnings, exclusively for the headers of this library (i.e., use something like -isystem
). I could use #pragma
shenanigans but I’m of the opinion that it should be handled by the build system.
The library producing the warnings is imported using FetchContent_Declare
.
Ideally the solution would work with CMake 3.20. It should rely on CMake and not user (me) specified compiler flags.
An error occurred: Sorry, new users can only put 2 links in a post.
here is the rest of the sources:
FetchContent_Declare
: cmakeorg/cmake/help/latest/module/FetchContent.html#command:fetchcontent_declare
add_subdirectory()
: cmakeorg/cmake/help/latest/command/add_subdirectory.html#command:add_subdirectory