Add dynamic catch 2 install

This commit is contained in:
Joey Yakimowich-Payne 2026-02-12 13:13:36 -07:00
commit 2e0cb27987
No known key found for this signature in database
GPG key ID: DDF6AF5B21B407D4

View file

@ -54,7 +54,15 @@ endif()
if(WARPPIPE_BUILD_TESTS) if(WARPPIPE_BUILD_TESTS)
enable_testing() enable_testing()
find_package(Catch2 3 REQUIRED) find_package(Catch2 3 QUIET)
if(NOT Catch2_FOUND)
FetchContent_Declare(Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.5.2
)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
endif()
add_executable(warppipe_tests tests/warppipe_tests.cpp) add_executable(warppipe_tests tests/warppipe_tests.cpp)
target_link_libraries(warppipe_tests PRIVATE warppipe Catch2::Catch2WithMain) target_link_libraries(warppipe_tests PRIVATE warppipe Catch2::Catch2WithMain)
target_compile_definitions(warppipe PRIVATE WARPPIPE_TESTING) target_compile_definitions(warppipe PRIVATE WARPPIPE_TESTING)