Support version 3 of Catch2
This commit is contained in:
parent
27252986a8
commit
f015a9444d
|
@ -67,6 +67,10 @@ use_package(
|
||||||
|
|
||||||
# find catch2 (required by tests)
|
# find catch2 (required by tests)
|
||||||
use_package(TARGET_NAME Catch2::Catch2 PACKAGE_NAME Catch2 LIBRARIES_VARIABLE "TEST_LIBRARIES")
|
use_package(TARGET_NAME Catch2::Catch2 PACKAGE_NAME Catch2 LIBRARIES_VARIABLE "TEST_LIBRARIES")
|
||||||
|
if (Catch2_VERSION VERSION_GREATER_EQUAL 3)
|
||||||
|
list(APPEND CATCH2_DEFINITIONS CATCH2_SPLIT_HEADERS)
|
||||||
|
list(APPEND TEST_LIBRARIES Catch2::Catch2WithMain)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# find threading library (required by examples)
|
# find threading library (required by examples)
|
||||||
use_package(TARGET_NAME Threads::Threads PACKAGE_NAME Threads LIBRARIES_VARIABLE "TEST_LIBRARIES")
|
use_package(TARGET_NAME Threads::Threads PACKAGE_NAME Threads LIBRARIES_VARIABLE "TEST_LIBRARIES")
|
||||||
|
@ -100,6 +104,7 @@ include(TestUtilities)
|
||||||
list(APPEND TEST_LIBRARIES ${META_TARGET_NAME})
|
list(APPEND TEST_LIBRARIES ${META_TARGET_NAME})
|
||||||
foreach (TEST ${TESTS})
|
foreach (TEST ${TESTS})
|
||||||
configure_test_target(TEST_NAME "${TEST}_tests" SRC_FILES "tests/${TEST}.cc" LIBRARIES "${TEST_LIBRARIES}")
|
configure_test_target(TEST_NAME "${TEST}_tests" SRC_FILES "tests/${TEST}.cc" LIBRARIES "${TEST_LIBRARIES}")
|
||||||
|
target_compile_definitions("${META_TARGET_NAME}_${TEST}_tests" PRIVATE "${CATCH2_DEFINITIONS}")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
foreach (EXAMPLE ${EXAMPLES})
|
foreach (EXAMPLE ${EXAMPLES})
|
||||||
configure_test_target(TEST_NAME "${EXAMPLE}_example" SRC_FILES "examples/${EXAMPLE}.cc" LIBRARIES "${TEST_LIBRARIES}")
|
configure_test_target(TEST_NAME "${EXAMPLE}_example" SRC_FILES "examples/${EXAMPLE}.cc" LIBRARIES "${TEST_LIBRARIES}")
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
#include "../lmdb-safe.hh"
|
#include "../lmdb-safe.hh"
|
||||||
|
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN // for catch2 < 3
|
||||||
|
#ifdef CATCH2_SPLIT_HEADERS
|
||||||
|
#include <catch2/catch_all.hpp>
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <c++utilities/application/global.h>
|
#include <c++utilities/application/global.h>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
#include "../lmdb-boost-serialization.hh"
|
#include "../lmdb-boost-serialization.hh"
|
||||||
#include "../lmdb-typed.hh"
|
#include "../lmdb-typed.hh"
|
||||||
|
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN // for catch2 < 3
|
||||||
|
#ifdef CATCH2_SPLIT_HEADERS
|
||||||
|
#include <catch2/catch_all.hpp>
|
||||||
|
#else
|
||||||
#include <catch2/catch.hpp>
|
#include <catch2/catch.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <c++utilities/application/global.h>
|
#include <c++utilities/application/global.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue