diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f352fd7b6..22ef24502 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,5 @@ # @author Oliver Thomson Brown +# @author Tyson Jones (patched MSVC and test discovery) add_executable(tests main.cpp @@ -19,5 +20,5 @@ if (QUEST_ENABLE_DEPRECATED_API) add_subdirectory(deprecated) endif() -# let Catch2 register all tests with CTest -catch_discover_tests(tests) +# defer test discovery, so that (e.g.) MPI libs aren't loaded during build +catch_discover_tests(tests DISCOVERY_MODE PRE_TEST) diff --git a/tests/deprecated/CMakeLists.txt b/tests/deprecated/CMakeLists.txt index 2a97b602c..570561332 100644 --- a/tests/deprecated/CMakeLists.txt +++ b/tests/deprecated/CMakeLists.txt @@ -1,5 +1,6 @@ # @author Oliver Thomson Brown # @author Erich Essmann (patched MPI) +# @author Tyson Jones (deferred test discovery) add_executable(dep_tests test_main.cpp @@ -18,4 +19,4 @@ if (QUEST_ENABLE_MPI) target_link_libraries(dep_tests PRIVATE MPI::MPI_CXX) endif() -catch_discover_tests(dep_tests) \ No newline at end of file +catch_discover_tests(dep_tests DISCOVERY_MODE PRE_TEST) \ No newline at end of file