有没有办法为 FetchContent 目标获取 -isystem?
Is there a way to get -isystem for FetchContent targets?
NO_SYSTEM_FROM_IMPORTED tells us that IMPORTED
targets automagically get -isystem
. Does that also hold for targets introduced to the project with FetchContent?
如果不是(我假设是因为在获取的目标上有 clang-tidy 警告问题),获得此类目标的 -isystem
的最佳方法是什么?
其实很简单(感谢@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}")
NO_SYSTEM_FROM_IMPORTED tells us that IMPORTED
targets automagically get -isystem
. Does that also hold for targets introduced to the project with FetchContent?
如果不是(我假设是因为在获取的目标上有 clang-tidy 警告问题),获得此类目标的 -isystem
的最佳方法是什么?
其实很简单(感谢@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}")