make it compile with cmake.

This commit is contained in:
2025-09-23 19:08:56 +02:00
parent 59411ea4ce
commit 377582c833
25 changed files with 56742 additions and 78 deletions

21
tests/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
# Testing library
FetchContent_Declare(
catch
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.6)
FetchContent_MakeAvailable(catch)
# Adds Catch2::Catch2
# Tests need to be added as executables first
add_executable(testlib tests.cpp)
# I'm using C++17 in the test
target_compile_features(testlib PRIVATE cxx_std_17)
# Should be linked to the main library, as well as the Catch2 testing library
target_link_libraries(testlib PRIVATE inc 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 COMMAND testlib) # Command can be a target

View File

@ -1 +1,2 @@
#include "tests.h"
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>