mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-08-31 22:21:13 +02:00
add and use WarningsAsErrors cmake module
export cxx_std_20 with target_compile_features() but do not export pedantic Waning options!
This commit is contained in:
parent
f0fe8d1cf6
commit
5e07aa91ac
4 changed files with 20 additions and 14 deletions
|
@ -29,17 +29,10 @@ endif()
|
|||
file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp)
|
||||
add_executable(${PROJECT_NAME} ${sources})
|
||||
target_link_libraries(${PROJECT_NAME} doctest::doctest Greeter::Greeter)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
|
||||
# enable compiler warnings
|
||||
if(NOT TEST_INSTALLED_VERSION)
|
||||
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(${PROJECT_NAME} PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS)
|
||||
endif()
|
||||
endif()
|
||||
include(../cmake/WarningsAsErrors.cmake)
|
||||
|
||||
# ---- Add GreeterTests ----
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue