From f3ecdb59c0888da97898d3c12c531bc91da476d3 Mon Sep 17 00:00:00 2001 From: mattg3004 Date: Tue, 27 Aug 2024 12:51:23 +0100 Subject: [PATCH] clang --- tests/CMakeLists.txt | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 44e4375..ed7073c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,20 +1,21 @@ find_package(Catch2 3 REQUIRED) -# These tests can use the Catch2-provided main -set(TESTS_TO_RUN test_main.cpp test_host.cpp test_model.cpp) -list(SORT TESTS_TO_RUN) -file(GLOB ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp" ) -list(SORT ALL_FILES) +#These tests can use the Catch2 - provided main + set(TESTS_TO_RUN test_main.cpp test_host.cpp test_model.cpp) + list(SORT TESTS_TO_RUN) file(GLOB ALL_FILES RELATIVE $ { + CMAKE_CURRENT_SOURCE_DIR + } "*.cpp") list(SORT ALL_FILES) -# Check globbing doesn't find any other tests, whilst still ensuring that generated Make files rebuild appropriately. -if (NOT ("${ALL_FILES}" STREQUAL "${TESTS_TO_RUN}")) - message(INFO " Expected tests = ${TESTS_TO_RUN}") - message(INFO " Found tests = ${ALL_FILES}") - message(SEND_ERROR "Some tests are missing from TESTS_TO_RUN, please add in tests/CMakeLists.txt") -endif() +#Check globbing doesn't find any other tests, whilst still ensuring that generated Make files rebuild appropriately. + if (NOT("${ALL_FILES}" STREQUAL "${TESTS_TO_RUN}")) + message(INFO " Expected tests = ${TESTS_TO_RUN}") + message(INFO " Found tests = ${ALL_FILES}") + message(SEND_ERROR + "Some tests are missing from TESTS_TO_RUN, " + "please add in tests/CMakeLists.txt") endif() -add_executable(tests ${TESTS_TO_RUN}) -target_link_libraries(tests PRIVATE Catch2::Catch2WithMain model) + add_executable(tests ${TESTS_TO_RUN}) + target_link_libraries( + tests PRIVATE Catch2::Catch2WithMain model) -include(CTest) -include(Catch) -catch_discover_tests(tests) + include(CTest) include(Catch) + catch_discover_tests(tests)