Generalize "IMPORTED_NO_SYSTEM" to "SYSTEM"
CMake is an amazing project that significantly reduces the effort of building C++. Thanks for all the maintainers!
!6627 (merged) introduces a property named "IMPORTED_NO_SYSTEM" that affects whether the include directories are treated as system include directories. Indeed, a similar property is also needed for normal targets, especially with the presence of FetchContent APIs:
add_executable(myexe myexe.cpp)
FetchContent_Declare(
some_3rd_lib
GIT_REPOSITORY https://github.com/xxx/xxx
)
FetchContent_MakeAvailable(some_3rd_lib)
target_link_libraries(myexe some_3rd_lib)
# When adding the following line, We don't want errors in the header files of some_3rd_lib to be reported
target_compile_options(myexe -Werror)
It will be appreciated if "IMPORTED_NO_SYSTEM" can be generalized to a new "SYSTEM" property, which affects all kinds of targets instead of just imported targets. For imported target its default value for imported targets will be ON
, while for other targets its default value will be OFF
.
If the maintainers like this idea, I'd like to submit a PR. I'm also open to further discussion if needed :)