Skip to content

Commit

Permalink
clang
Browse files Browse the repository at this point in the history
  • Loading branch information
mattg3004 committed Aug 27, 2024
1 parent 122d3a9 commit f3ecdb5
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit f3ecdb5

Please sign in to comment.