1
+ include (CTest )
1
2
include (DownloadProject )
2
3
3
4
# Download and configure Catch2 for the tests
@@ -7,6 +8,7 @@ download_project(PROJ Catch2
7
8
UPDATE_DISCONNECTED 1
8
9
)
9
10
list (APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR} /contrib )
11
+ include (ParseAndAddCatchTests )
10
12
11
13
# Configure Catch2 so that it looks like a proper target
12
14
add_library (Catch2 INTERFACE )
@@ -20,6 +22,15 @@ target_include_directories(Catch2 INTERFACE
20
22
option (GFX_TIMSORT_USE_VALGRIND "Whether to run the tests with Valgrind" OFF )
21
23
set (GFX_TIMSORT_SANITIZE "" CACHE STRING "Comma-separated list of options to pass to -fsanitize" )
22
24
25
+ # Configure Valgrind
26
+ if (${GFX_TIMSORT_USE_VALGRIND} )
27
+ find_program (MEMORYCHECK_COMMAND valgrind )
28
+ set (MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --track-origins=yes --error-exitcode=1 --show-reachable=no" )
29
+ if (APPLE )
30
+ set (MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_CURRENT_SOURCE_DIR} /valgrind-osx.supp )
31
+ endif ()
32
+ endif ()
33
+
23
34
macro (configure_tests target )
24
35
# Add required dependencies to tests
25
36
target_link_libraries (${target} PRIVATE
@@ -79,26 +90,13 @@ add_executable(cxx_98_tests
79
90
)
80
91
configure_tests (cxx_98_tests )
81
92
target_compile_features (cxx_98_tests PRIVATE cxx_std_98 )
93
+ ParseAndAddCatchTests (cxx_98_tests )
82
94
83
- # Tests that require C++11 support to run
95
+ # Tests that require C++11 support
84
96
add_executable (cxx_11_tests
85
97
main.cpp
86
98
cxx_11_tests.cpp
87
99
)
88
100
configure_tests (cxx_11_tests )
89
101
target_compile_features (cxx_11_tests PRIVATE cxx_std_11 )
90
-
91
- # Configure Valgrind
92
- if (${GFX_TIMSORT_USE_VALGRIND} )
93
- find_program (MEMORYCHECK_COMMAND valgrind )
94
- set (MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --track-origins=yes --error-exitcode=1 --show-reachable=no" )
95
- if (APPLE )
96
- set (MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_CURRENT_SOURCE_DIR} /valgrind-osx.supp )
97
- endif ()
98
- endif ()
99
-
100
- include (CTest )
101
- include (ParseAndAddCatchTests )
102
-
103
- ParseAndAddCatchTests (cxx_98_tests )
104
102
ParseAndAddCatchTests (cxx_11_tests )
0 commit comments