@@ -86,7 +86,7 @@ target_compile_definitions(Catch2 PUBLIC DO_NOT_USE_WMAIN)
8686target_link_libraries (Catch2 PRIVATE iris_cxx_test_external )
8787target_link_libraries (Catch2WithMain PRIVATE iris_cxx_test_external )
8888
89- target_link_libraries (iris_cxx_test INTERFACE Catch2::Catch2WithMain )
89+ target_link_libraries (iris_cxx_test INTERFACE Catch2::Catch2 )
9090
9191# -----------------------------------------------------------------
9292# Common CMake utilities for testing
@@ -95,7 +95,7 @@ function(iris_define_test_headers test_name)
9595 target_sources (${test_name} _test PRIVATE FILE_SET HEADERS FILES ${ARGN} )
9696endfunction ()
9797
98- function (iris_define_test test_name )
98+ function (_iris_define_test_impl test_name libs )
9999 add_executable (${test_name} _test ${ARGN} )
100100 target_include_directories (${test_name} _test PRIVATE ${CMAKE_CURRENT_FUNCTION_LIST_DIR} )
101101 target_include_directories (${test_name} _test PRIVATE ${CMAKE_CURRENT_LIST_DIR} )
@@ -112,7 +112,7 @@ function(iris_define_test test_name)
112112 target_sources (${test_name} _test PRIVATE "${CMAKE_CURRENT_FUNCTION_LIST_DIR} /cpp.hint" )
113113 endif ()
114114
115- target_link_libraries (${test_name} _test PRIVATE Iris::Iris iris_cxx_test )
115+ target_link_libraries (${test_name} _test PRIVATE Iris::Iris iris_cxx_test ${libs} )
116116 add_test (NAME ${test_name} _test COMMAND ${test_name} _test --colour-mode=ansi )
117117
118118 if (MSVC )
@@ -124,6 +124,14 @@ function(iris_define_test test_name)
124124 endif ()
125125endfunction ()
126126
127+ function (iris_define_test test_name )
128+ _iris_define_test_impl (${test_name} Catch2::Catch2WithMain ${ARGN} )
129+ endfunction ()
130+
131+ function (iris_define_test_no_main test_name )
132+ _iris_define_test_impl (${test_name} "" ${ARGN} )
133+ endfunction ()
134+
127135function (iris_define_tests )
128136 foreach (test_name IN LISTS ARGV)
129137 iris_define_test (${test_name} ${test_name} .cpp )
0 commit comments