@@ -28,10 +28,6 @@ find_package(Catch2 CONFIG REQUIRED)
2828
2929include (Catch)
3030
31- add_library (catch_main OBJECT catch_main.cpp)
32- target_link_libraries (catch_main PUBLIC Catch2::Catch2)
33- target_link_libraries (catch_main PRIVATE myproject::project_options)
34-
3531# Provide a simple smoke test to make sure that the CLI works and can display a --help message
3632add_test (NAME cli.has_help COMMAND intro --help)
3733
@@ -43,7 +39,7 @@ add_test(NAME cli.version_matches COMMAND intro --version)
4339set_tests_properties (cli.version_matches PROPERTIES PASS_REGULAR_EXPRESSION "${PROJECT_VERSION} " )
4440
4541add_executable (tests tests.cpp)
46- target_link_libraries (tests PRIVATE myproject::project_warnings myproject::project_options catch_main )
42+ target_link_libraries (tests PRIVATE myproject::project_warnings myproject::project_options Catch2::Catch2WithMain )
4743
4844# automatically discover tests that are defined in catch based test files you can modify the unittests. Set TEST_PREFIX
4945# to whatever you want, or use different for different binaries
@@ -52,7 +48,7 @@ catch_discover_tests(
5248 TEST_PREFIX
5349 "unittests."
5450 REPORTER
55- xml
51+ XML
5652 OUTPUT_DIR
5753 .
5854 OUTPUT_PREFIX
@@ -62,14 +58,14 @@ catch_discover_tests(
6258
6359# Add a file containing a set of constexpr tests
6460add_executable (constexpr_tests constexpr_tests.cpp)
65- target_link_libraries (constexpr_tests PRIVATE myproject::project_options myproject::project_warnings catch_main )
61+ target_link_libraries (constexpr_tests PRIVATE myproject::project_options myproject::project_warnings Catch2::Catch2WithMain )
6662
6763catch_discover_tests(
6864 constexpr_tests
6965 TEST_PREFIX
7066 "constexpr."
7167 REPORTER
72- xml
68+ XML
7369 OUTPUT_DIR
7470 .
7571 OUTPUT_PREFIX
@@ -80,15 +76,15 @@ catch_discover_tests(
8076# Disable the constexpr portion of the test, and build again this allows us to have an executable that we can debug when
8177# things go wrong with the constexpr testing
8278add_executable (relaxed_constexpr_tests constexpr_tests.cpp)
83- target_link_libraries (relaxed_constexpr_tests PRIVATE myproject::project_options myproject::project_warnings catch_main )
79+ target_link_libraries (relaxed_constexpr_tests PRIVATE myproject::project_options myproject::project_warnings Catch2::Catch2WithMain )
8480target_compile_definitions (relaxed_constexpr_tests PRIVATE -DCATCH_CONFIG_RUNTIME_STATIC_REQUIRE)
8581
8682catch_discover_tests(
8783 relaxed_constexpr_tests
8884 TEST_PREFIX
8985 "relaxed_constexpr."
9086 REPORTER
91- xml
87+ XML
9288 OUTPUT_DIR
9389 .
9490 OUTPUT_PREFIX
0 commit comments