cmake: Only add catch2 library if ENABLE_TESTS is enabled

This commit is contained in:
OpenSauce04 2026-02-23 22:16:09 +00:00 committed by OpenSauce
parent 17f4c52e56
commit d721cbe29b

View file

@ -50,15 +50,17 @@ else()
endif() endif()
# Catch2 # Catch2
add_library(catch2 INTERFACE) if (ENABLE_TESTS)
if(USE_SYSTEM_CATCH2) add_library(catch2 INTERFACE)
find_package(Catch2 3.0.0 REQUIRED) if(USE_SYSTEM_CATCH2)
else() find_package(Catch2 3.0.0 REQUIRED)
set(CATCH_INSTALL_DOCS OFF CACHE BOOL "") else()
set(CATCH_INSTALL_EXTRAS OFF CACHE BOOL "") set(CATCH_INSTALL_DOCS OFF CACHE BOOL "")
add_subdirectory(catch2) set(CATCH_INSTALL_EXTRAS OFF CACHE BOOL "")
add_subdirectory(catch2)
endif()
target_link_libraries(catch2 INTERFACE Catch2::Catch2WithMain)
endif() endif()
target_link_libraries(catch2 INTERFACE Catch2::Catch2WithMain)
# Crypto++ # Crypto++
if(USE_SYSTEM_CRYPTOPP) if(USE_SYSTEM_CRYPTOPP)