Skip to content

Commit 166170e

Browse files
ChristianTackeGSIdennisklein
authored andcommitted
build: Use FetchContent_Declare(SYSTEM)
CMake 3.25 allows setting a "SYSTEM" option on FetchContent_Declare. Declare Catch2 using this option (if supported). This way consumers of Catch2 targets will consider catch2 includes as system includes and not show warnings for them.
1 parent 63c0b3a commit 166170e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

third_party/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
# copied verbatim in the file "LICENSE" #
77
################################################################################
88

9+
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.25)
10+
set(declare_with_system "SYSTEM")
11+
else()
12+
set(declare_with_system "")
13+
endif()
14+
915
if(BUILD_TESTING)
1016
Include(FetchContent)
1117

@@ -14,6 +20,7 @@ if(BUILD_TESTING)
1420
SOURCE_DIR ${CMAKE_SOURCE_DIR}/third_party/Catch2_v3.4.0
1521
# GIT_REPOSITORY https://github.com/catchorg/Catch2.git
1622
# GIT_TAG v3.4.0
23+
${declare_with_system}
1724
)
1825

1926
FetchContent_MakeAvailable(Catch2)

0 commit comments

Comments
 (0)