@@ -8,16 +8,29 @@ enable_testing()
88
99option (LSL_BENCHMARKS "Enable benchmarks in unit tests" OFF )
1010
11+
12+ Include (FetchContent)
13+ FetchContent_Declare(
14+ Catch2
15+ GIT_REPOSITORY https://github.com/catchorg/Catch2.git
16+ GIT_TAG v3.0.1 # or a later release
17+ )
18+ FetchContent_MakeAvailable(Catch2)
19+
20+
1121add_library (catch_main OBJECT catch_main.cpp)
1222target_compile_features (catch_main PUBLIC cxx_std_14)
1323if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
1424 target_link_libraries (catch_main PUBLIC log )
1525endif ()
1626find_package (Threads REQUIRED)
17- target_link_libraries (catch_main PUBLIC Threads::Threads)
27+ target_link_libraries (catch_main
28+ PUBLIC
29+ Threads::Threads
30+ Catch2::Catch2
31+ )
1832
1933target_compile_definitions (catch_main PRIVATE LSL_VERSION_INFO="${LSL_VERSION_INFO} " )
20- target_include_directories (catch_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /../thirdparty)
2134if (LSL_BENCHMARKS)
2235 target_compile_definitions (catch_main PUBLIC CATCH_CONFIG_ENABLE_BENCHMARKING)
2336endif ()
@@ -30,9 +43,9 @@ add_library(common OBJECT
3043)
3144target_compile_features (common PUBLIC cxx_std_14)
3245target_include_directories (common PUBLIC
33- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /../thirdparty>
3446 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /../src>
3547)
48+ target_link_libraries (common PUBLIC Catch2::Catch2)
3649
3750
3851add_executable (lsl_test_exported
@@ -58,6 +71,7 @@ add_executable(lsl_test_internal
5871)
5972target_link_libraries (lsl_test_internal PRIVATE lslobj lslboost common catch_main)
6073
74+
6175if (LSL_BENCHMARKS)
6276 # to get somewhat reproducible performance numbers:
6377 # /usr/bin/time -v testing/lsl_test_exported --benchmark-samples 100 bounce
@@ -77,6 +91,18 @@ set(LSL_TESTS lsl_test_exported lsl_test_internal)
7791foreach (lsltest ${LSL_TESTS} )
7892 add_test (NAME ${lsltest} COMMAND ${lsltest} --wait-for-keypress never)
7993 installLSLApp(${lsltest} )
94+
95+ if (WIN32 )
96+ # Copy dependencies into build directory to enable debugging builds in Windows.
97+ add_custom_command (TARGET ${lsltest}
98+ POST_BUILD
99+ COMMAND
100+ ${CMAKE_COMMAND} -E copy_if_different
101+ $<TARGET_RUNTIME_DLLS:${lsltest} >
102+ $<TARGET_FILE_DIR:${lsltest} >
103+ COMMAND_EXPAND_LISTS
104+ )
105+ endif (WIN32 )
80106endforeach ()
81107
82108installLSLAuxFiles(lsl_test_exported directory lslcfgs)
0 commit comments