Don’t know if it helps or if it’s remotely right way but this is an example of what I do:
# Unfortunately, nlohmann_json does not set its headers as SYSTEM,
# so we get errors with our warning level.
get_target_property(_inc nlohmann_json::nlohmann_json INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(nlohmann_json SYSTEM INTERFACE ${_inc})
So in short - I find the right target and alter INTERFACE_INCLUDE_DIRECTORIES
to be seen as SYSTEM
. Solves the problem for me.