Skip to content

Commit

Permalink
trying to find catch2 submodule part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
shutsch committed Feb 22, 2024
1 parent ea289c1 commit 334fc07
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ set(BUILD_PYTHON_PACKAGE OFF CACHE BOOL OFF)

if (COMPILE_TESTS)
message("-- Trying to find Catch2 to compile the test cases. Turn off via setting 'COMPILE_TESTS=OFF' in your environment before installation. ")
set(INTERNAL_findCatch2_DIR ${PROJECT_SOURCE_DIR}/extern/Catch2)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${INTERNAL_findCatch2_DIR}")
find_package(Catch2 3)
if (Catch2_FOUND)
message("-- catch2 library found. Tests will be compiled.")
message("-- global installation of catch2 library found. Tests will be compiled.")
else()
message("-- catch2 library not found. Testing disabled.")
set(COMPILE_TESTS OFF)
set(INTERNAL_findCatch2_DIR ${PROJECT_SOURCE_DIR}/extern/Catch2)
if(NOT EXISTS ${INTERNAL_findCatch2_DIR})
message(FATAL_ERROR "The catch2 submodule was not initialized! Please run 'git submodule update --init'. Alternativly you can install catch2 globally on your system." )
endif()
add_subdirectory(INTERNAL_findCatch2_DIR)
message("-- catch2 library found as a submodule. Tests will be compiled.")
endif()
else()
set(Catch2_FOUND OFF)
Expand Down

0 comments on commit 334fc07

Please sign in to comment.