Issue
NO_SYSTEM_FROM_IMPORTED tells us that IMPORTED
targets automagically get -isystem
. Does that also hold for targets introduced to the project with FetchContent?
If not (I assume so due to having problems with clang-tidy warnings on fetched targets), what is the best way to get -isystem
for such targets?
Solution
It is actually really easy (kudos to @Tsyvarev):
include (FetchContent)
set (FETCHCONTENT_QUIET FALSE)
FetchContent_Declare (
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.4.2
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable (Catch2)
### here is what makes all include directories -isystem
get_target_property(CATCH2_IID Catch2 INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(Catch2 PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${CATCH2_IID}")
Answered By - Florian Berchtold Answer Checked By - Mary Flores (WPSolving Volunteer)