diff --git a/CMakeLists.txt b/CMakeLists.txt index facd9b88..b40f7763 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,19 +38,23 @@ macro(fetch_catch2) include(FetchContent) FetchContent_Declare(Catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG 62fd660583d3ae7a7886930b413c3c570e89786c #v2.13.9 + GIT_TAG 3f0283de7a9c43200033da996ff9093be3ac84dc #v3.3.2 ) FetchContent_GetProperties(Catch2) if(NOT catch2_POPULATED) FetchContent_Populate(Catch2) + set(old_build_shared_libs ${BUILD_SHARED_LIBS}) + set(BUILD_SHARED_LIBS OFF) add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR}) + target_compile_features(Catch2 PRIVATE cxx_std_17) list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/contrib) + set(BUILD_SHARED_LIBS ${old_build_shared_libs}) endif() endmacro() if (BUILD_TESTING) enable_testing() - find_package(Catch2 2.3.0 QUIET) + find_package(Catch2 3.1.1 QUIET) if (NOT Catch2_FOUND) fetch_catch2() endif() @@ -58,7 +62,6 @@ if (BUILD_TESTING) add_subdirectory(tests) endif() - configure_file(nuspell.pc.in nuspell.pc @ONLY) #configure_file(NuspellConfig.cmake NuspellConfig.cmake COPYONLY) write_basic_package_version_file(NuspellConfigVersion.cmake diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 5bb72eae..0c657062 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ -add_executable(unit_test unit_test.cxx catch_main.cxx) -target_link_libraries(unit_test PRIVATE nuspell Catch2::Catch2) +add_executable(unit_test unit_test.cxx) +target_link_libraries(unit_test PRIVATE nuspell Catch2::Catch2WithMain) if (MSVC) target_compile_options(unit_test PRIVATE "/utf-8") # Consider doing this for all the other targets by setting this flag diff --git a/tests/catch_main.cxx b/tests/catch_main.cxx deleted file mode 100644 index e23de88c..00000000 --- a/tests/catch_main.cxx +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright 2017-2023 Dimitrij Mijoski - * - * This file is part of Nuspell. - * - * Nuspell is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Nuspell is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Nuspell. If not, see . - */ - -#define CATCH_CONFIG_MAIN -#include diff --git a/tests/unit_test.cxx b/tests/unit_test.cxx index 8d6ba7be..9f52d108 100644 --- a/tests/unit_test.cxx +++ b/tests/unit_test.cxx @@ -16,7 +16,8 @@ * along with Nuspell. If not, see . */ -#include +#include +#include #include #include diff --git a/vcpkg.json b/vcpkg.json index 829209a3..627f9b47 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -3,7 +3,7 @@ "dependencies": [ { "name": "catch2", - "version>=": "2.13.9" + "version>=": "3.3.2" }, { "name": "getopt",