mirror of
https://github.com/TheLartians/ModernCppStarter.git
synced 2025-09-03 07:30:53 +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
12
cmake/WarningsAsErrors.cmake
Normal file
12
cmake/WarningsAsErrors.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror -Wshadow)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 10.0)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wdeprecated-copy-dtor -Wnewline-eof)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
|
||||
endif()
|
Loading…
Add table
Add a link
Reference in a new issue