When used as subproject, treat Catch2 cmake target include paths as SYSTEM to avoid compiler warnings in Catch2 headers.

This commit is contained in:
Alexander Shaduri 2021-03-17 14:49:53 +04:00
parent 037ddbc75c
commit 92d827c1e9

View File

@ -271,11 +271,20 @@ target_compile_features(Catch2
cxx_variadic_macros
)
target_include_directories(Catch2
PUBLIC
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if (NOT_SUBPROJECT)
target_include_directories(Catch2
PUBLIC
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
else()
target_include_directories(Catch2
SYSTEM PUBLIC
$<BUILD_INTERFACE:${SOURCES_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
endif()
add_library(Catch2WithMain STATIC