summarylogtreecommitdiffstats
path: root/use-system-catch2.patch
blob: b6bc723078161349d3f0a6766f12dd60cd2bd152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Tobias Frost <tobi@debian.org>
Date: Mon, 20 Dec 2021 02:29:22 +0800
Subject: Use packaged catch2 library

Bug-Debian: https://bugs.debian.org/979826
---
 tests/CMakeLists.txt | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index b91f75b..1322cab 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -4,15 +4,8 @@
 set(TEST_DATA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/data)
 file(TO_NATIVE_PATH "${TEST_DATA_DIR}" TEST_DATA_DIR)
 
-add_library(Catch2 INTERFACE)
-list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/Catch2)
-target_include_directories(Catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
-add_library(Catch2::Catch2 ALIAS Catch2)
-if (APPLE)
-	# OSX builds targeting OSX 10.9 do not support new std::uncought_exception()
-	# see https://github.com/catchorg/Catch2/issues/1218
-	target_compile_definitions(Catch2 INTERFACE -DCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS)
-endif()
+find_package(Catch2 REQUIRED)
+
 include(Catch)
 
 set(CATCH_EXTRA_ARGS "" CACHE STRING "Extra arguments for catch2 test suites.")
@@ -20,7 +13,7 @@ set(CATCH_EXTRA_ARGS "" CACHE STRING "Extra arguments for catch2 test suites.")
 add_library(test_common INTERFACE)
 target_compile_definitions(test_common INTERFACE TEST_DATA_DIR=R"\(${TEST_DATA_DIR}\)" CATCH_CONFIG_FAST_COMPILE)
 target_link_libraries(test_common INTERFACE Catch2::Catch2)
-
+target_include_directories(test_common INTERFACE ${CMAKE_CURRENT_LIST_DIR})
 if (APPLE)
     target_link_libraries(test_common INTERFACE "-liconv -framework IOKit" "-framework CoreFoundation" -lc++)
 endif()