diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-02-26 12:07:40 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-02-26 12:07:40 +0100 |
| commit | 0384acce9fe18c59605835300c52d4b5bc38db45 (patch) | |
| tree | 4b7e3363ccf71d6f426dd2d95aaee0f98175f24a /tests | |
| parent | 440d47cae6431de3332ac934b6056a970cc1a0d7 (diff) | |
| download | newtype-0384acce9fe18c59605835300c52d4b5bc38db45.tar.xz newtype-0384acce9fe18c59605835300c52d4b5bc38db45.zip | |
build: clean up CMakeLists.txt files
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/CMakeLists.txt | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 47b8331..8e5e798 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,9 +1,17 @@ -find_package("Catch2" "3.1" +include("FetchContent") + +FetchContent_Declare( + "Catch2" + URL "https://github.com/catchorg/Catch2/archive/refs/tags/v3.7.0.zip" + URL_HASH "SHA256=75b04c94471a70680f10f5d0d985bd1a96b8941d040d6a7bfd43f6c6b1de9daf" + EXCLUDE_FROM_ALL + FIND_PACKAGE_ARGS + "3.7.0" EXACT COMPONENTS "Catch2WithMain" - REQUIRED ) -include("CTest") +FetchContent_MakeAvailable("Catch2") + include("Catch") file(GLOB SOURCES @@ -12,17 +20,16 @@ file(GLOB SOURCES "src/*.cpp" ) - -add_executable("${PROJECT_NAME}_tests" +add_executable("newtype_tests" ${SOURCES} ) -target_link_libraries("${PROJECT_NAME}_tests" - "${PROJECT_NAME}::${PROJECT_NAME}" +target_link_libraries("newtype_tests" + "newtype::lib" "Catch2::Catch2WithMain" ) -target_compile_options("${PROJECT_NAME}_tests" PRIVATE +target_compile_options("newtype_tests" PRIVATE "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wall>" "$<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>" "$<$<CXX_COMPILER_ID:GNU,Clang>:-Werror>" @@ -30,4 +37,9 @@ target_compile_options("${PROJECT_NAME}_tests" PRIVATE "$<$<CXX_COMPILER_ID:GNU>:-fconcepts-diagnostics-depth=5>" ) -catch_discover_tests("${PROJECT_NAME}_tests") +set_target_properties("newtype_tests" PROPERTIES + CMAKE_CXX_EXTENSIONS OFF + CMAKE_CXX_STANDARD_REQUIRED YES +) + +catch_discover_tests("newtype_tests") |
