1+ FIND_PACKAGE (Catch2 REQUIRED )
2+
13INCLUDE (CTest )
24INCLUDE (Catch )
35
4- ADD_LIBRARY (catch_main STATIC catch_main.cpp )
5- TARGET_LINK_LIBRARIES (catch_main PUBLIC CONAN_PKG::catch2 )
6- TARGET_LINK_LIBRARIES (catch_main PRIVATE project_options )
7-
86ADD_EXECUTABLE (catch_tests tests.cpp )
9- TARGET_LINK_LIBRARIES (catch_tests PRIVATE project_warnings project_options catch_main )
7+ TARGET_LINK_LIBRARIES (catch_tests PRIVATE project_warnings project_options Catch2::Catch2WithMain )
108
119# automatically discover tests that are defined in catch based test files you can modify the unittests. Set TEST_PREFIX
1210# to whatever you want, or use different for different binaries
@@ -25,7 +23,7 @@ CATCH_DISCOVER_TESTS(
2523
2624# Add a file containing a set of constexpr tests
2725ADD_EXECUTABLE (catch_constexpr_tests constexpr_tests.cpp )
28- TARGET_LINK_LIBRARIES (catch_constexpr_tests PRIVATE project_options project_warnings catch_main )
26+ TARGET_LINK_LIBRARIES (catch_constexpr_tests PRIVATE project_options project_warnings Catch2::Catch2WithMain )
2927
3028CATCH_DISCOVER_TESTS (
3129 catch_constexpr_tests
@@ -43,7 +41,7 @@ CATCH_DISCOVER_TESTS(
4341# Disable the constexpr portion of the test, and build again this allows us to have an executable that we can debug when
4442# things go wrong with the constexpr testing
4543ADD_EXECUTABLE (catch_relaxed_constexpr_tests constexpr_tests.cpp )
46- TARGET_LINK_LIBRARIES (catch_relaxed_constexpr_tests PRIVATE project_options project_warnings catch_main )
44+ TARGET_LINK_LIBRARIES (catch_relaxed_constexpr_tests PRIVATE project_options project_warnings Catch2::Catch2WithMain )
4745TARGET_COMPILE_DEFINITIONS (catch_relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE )
4846
4947CATCH_DISCOVER_TESTS (
0 commit comments