diff options
author | Carbenium <carbenium@outlook.com> | 2020-07-22 20:27:54 +0200 |
---|---|---|
committer | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-07-24 12:00:54 +0200 |
commit | 6a28ee7b2a4269aa7e43265d1cd0067537e3e883 (patch) | |
tree | 0318b45951240f81cdf9c3c36e493e16d75f81be /CMakeLists.txt | |
parent | 3c0ac7302f902d1811d2c215217a3d701f8b5b19 (diff) |
dep: Add catch2 unit test framework and wire it up
To enable the test suite, make sure to configure CMake with -DBUILD_TESTING=1 , since it is disabled by default. The catch2 dependency will be downloaded during configure time.
Also add a new target "tests-common", which includes unit tests for the "common" project. To finally run the tests use the "test" target.
CircleCI: Run unit tests
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0895367e778..ef7a576a7b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.11) # add this options before PROJECT keyword set(CMAKE_DISABLE_SOURCE_CHANGES ON) @@ -90,3 +90,12 @@ add_subdirectory(dep) # add core sources add_subdirectory(src) + +include(CTest) +if(BUILD_TESTING) + list(APPEND CMAKE_MODULE_PATH + "${Catch2_SOURCE_DIR}/contrib") + include(Catch) + + add_subdirectory(tests) +endif() |