Fix system Catch2 Detection
This commit is contained in:
parent
15ee136e13
commit
4eac146a8e
@ -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})
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user