From f837f28171970b56781a57b5dc503e6067abecd2 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 (cherry picked from commit 6a28ee7b2a4269aa7e43265d1cd0067537e3e883) --- cmake/options.cmake | 1 + cmake/showoptions.cmake | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'cmake') diff --git a/cmake/options.cmake b/cmake/options.cmake index 2551ec72140..9cc6f9cbe87 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -54,3 +54,4 @@ option(COPY_CONF "Copy authserver and worldserver .conf.dist files to the set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.") set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical hierarchical-folders) option(WITHOUT_GIT "Disable the GIT testing routines" 0) +option(BUILD_TESTING "Build test suite" 0) diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake index 66cec73089b..8cf5d85b913 100644 --- a/cmake/showoptions.cmake +++ b/cmake/showoptions.cmake @@ -39,6 +39,12 @@ else() message("* Build map/vmap tools : No") endif() +if(BUILD_TESTING) + message("* Build unit tests : Yes") +else() + message("* Build unit tests : No (default)") +endif() + if(USE_COREPCH) message("* Build core w/PCH : Yes (default)") else() -- cgit v1.2.3