rdricpp/tests/CMakeLists.txt

37 lines
824 B
CMake
Raw Permalink Normal View History

2024-02-04 18:23:31 +00:00
# Testing library
2024-02-14 09:53:46 +00:00
message("Guix = ${GUIX}")
if ( (NOT ${GUIX}) )
message("NOT GUIX")
include(FetchContent)
2024-02-14 09:25:34 +00:00
FetchContent_Declare(
catch
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.5.2)
FetchContent_MakeAvailable(catch)
endif() #Adds Catch2::Catch2
2024-02-14 09:53:46 +00:00
#If building manually
2024-02-14 09:25:34 +00:00
#add_subdirectory(Catch2-3.5.2)
include(CTest)
2024-02-14 09:53:46 +00:00
add_executable(tests tests.cpp test_cases.cpp test_cases.h)
target_compile_features(tests PRIVATE cxx_std_23)
2024-02-14 09:53:46 +00:00
# Should be linked to the rdricpp library, as well as the Catch2 testing library
2024-02-14 09:53:46 +00:00
if ( ${GUIX} )
include(Catch.cmake)
target_link_libraries(tests PRIVATE rdricpp Catch2Main Catch2)
2024-02-14 09:53:46 +00:00
else()
include(Catch)
target_link_libraries(tests PRIVATE rdricpp Catch2::Catch2WithMain)
2024-02-14 09:53:46 +00:00
endif()
2024-02-04 18:23:31 +00:00
catch_discover_tests(tests)
add_test(NAME Test COMMAND tests)