21 lines
637 B
CMake
21 lines
637 B
CMake
# Testing library
|
|
FetchContent_Declare(
|
|
catch2
|
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
|
GIT_TAG v2.9.1
|
|
)
|
|
|
|
FetchContent_MakeAvailable(catch2)
|
|
|
|
# Tests need to be added as executables first
|
|
add_executable(tests serenetests.cpp)
|
|
|
|
target_compile_features(tests PRIVATE cxx_std_20)
|
|
|
|
# Should be linked to the main library, as well as the Catch2 testing library
|
|
target_link_libraries(tests PRIVATE serene Catch2::Catch2)
|
|
|
|
# If you register a test, then ctest and make test will run it.
|
|
# You can also run examples and check the output, as well.
|
|
# add_test(NAME testlibtest serene testlib) # Command can be a target
|