Fix system Catch2 Detection
All checks were successful
buildbot/quartz-warriors-linux-podman-builder Build done.
buildbot/quartz-warriors-darwin-macos-builder Build done.
buildbot/quartz-warriors-freebsd-jail-builder Build done.

This commit is contained in:
S David 2023-12-09 17:06:07 -05:00
parent 15ee136e13
commit 4eac146a8e
2 changed files with 6 additions and 2 deletions

View File

@ -67,10 +67,14 @@ pkg_check_modules(SDL2_IMG "SDL2_image >= 0.29.0" REQUIRED)
pkg_check_modules(SDL2_GFX "SDL2_gfx >= 1.0.2" REQUIRED) pkg_check_modules(SDL2_GFX "SDL2_gfx >= 1.0.2" REQUIRED)
pkg_check_modules(NLOHMANN_JSON "nlohmann_json >= 3.11.2" REQUIRED) pkg_check_modules(NLOHMANN_JSON "nlohmann_json >= 3.11.2" REQUIRED)
message(CHECK_START "Detecting system Catch2 installation")
find_package(Catch2 3 QUIET) find_package(Catch2 3 QUIET)
if (CATCH2_FOUND) if(TARGET Catch2::Catch2)
message(CHECK_PASS "found")
set(USE_SYSTEM_CATCH2 ON) set(USE_SYSTEM_CATCH2 ON)
else()
message(CHECK_FAIL "not found")
endif() endif()
if (SDL2_FOUND) if (SDL2_FOUND)
@ -108,6 +112,7 @@ if(ENABLE_TESTS AND NOT USE_SYSTEM_CATCH2)
if (TARGET Catch2WithMain) if (TARGET Catch2WithMain)
set_target_properties(Catch2WithMain PROPERTIES CXX_STANDARD 20) set_target_properties(Catch2WithMain PROPERTIES CXX_STANDARD 20)
endif() endif()
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)
elseif(ENABLE_TESTS AND USE_SYSTEM_CATCH2) elseif(ENABLE_TESTS AND USE_SYSTEM_CATCH2)
include_directories(${CATCH2_INCLUDE_DIRS}) include_directories(${CATCH2_INCLUDE_DIRS})
link_directories(${CATCH2_LIBRARY_DIRS}) link_directories(${CATCH2_LIBRARY_DIRS})

View File

@ -34,7 +34,6 @@ target_link_libraries(unit-tests PRIVATE
# Extras: Catch2 Ctest integration. @{ # Extras: Catch2 Ctest integration. @{
# add catch2's ctest CMake module and register the tests defined by unit-tests # add catch2's ctest CMake module and register the tests defined by unit-tests
# using catch_discover_tests # using catch_discover_tests
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/extras)
include(CTest) include(CTest)
include(Catch) include(Catch)
catch_discover_tests(unit-tests) catch_discover_tests(unit-tests)