From 6a28ee7b2a4269aa7e43265d1cd0067537e3e883 Mon Sep 17 00:00:00 2001 From: Carbenium Date: Wed, 22 Jul 2020 20:27:54 +0200 Subject: 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 --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') 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() -- cgit v1.2.3