mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-09-03 23:50:53 +02:00
Merge branch 'master' into develop
This commit is contained in:
commit
9d1c7413f0
7 changed files with 27 additions and 38 deletions
|
@ -20,11 +20,7 @@ include(../cmake/tools.cmake)
|
|||
include(../cmake/CPM.cmake)
|
||||
CPMUsePackageLock(package-lock.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME doctest
|
||||
GITHUB_REPOSITORY onqtam/doctest
|
||||
GIT_TAG 2.4.5
|
||||
)
|
||||
CPMAddPackage("gh:onqtam/doctest#2.4.5")
|
||||
|
||||
if(TEST_INSTALLED_VERSION)
|
||||
find_package(Greeter ${PROJECT_VERSION} REQUIRED)
|
||||
|
@ -45,12 +41,13 @@ CPMAddPackage(
|
|||
file(GLOB sources CONFIGURE_DEPENDS source/*.cpp)
|
||||
add_executable(GreeterTests ${sources})
|
||||
target_link_libraries(GreeterTests doctest::doctest Greeter::Greeter)
|
||||
set_target_properties(GreeterTests PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
|
||||
|
||||
set_target_properties(GreeterTests PROPERTIES CXX_STANDARD 17)
|
||||
|
||||
# enable compiler warnings
|
||||
if(NOT TEST_INSTALLED_VERSION)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?[Cc]lang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
target_compile_options(Greeter PUBLIC -Wall -Wextra -Werror)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
target_compile_options(Greeter PUBLIC -Wall -Wpedantic -Wextra -Werror)
|
||||
elseif(MSVC)
|
||||
target_compile_options(Greeter PUBLIC /W4 /WX)
|
||||
target_compile_definitions(GreeterTests PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS)
|
||||
|
@ -61,7 +58,11 @@ endif()
|
|||
|
||||
enable_testing()
|
||||
|
||||
add_test(NAME greeterTests COMMAND GreeterTests -s false)
|
||||
# Note: doctest and similar testing frameworks can automatically configure CMake tests. For other
|
||||
# testing frameworks add the tests target instead: add_test(NAME greeterTests COMMAND GreeterTests)
|
||||
|
||||
include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake)
|
||||
doctest_discover_tests(GreeterTests)
|
||||
|
||||
# ---- code coverage ----
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue