1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00
ModernCppStarter/cmake/WarningsAsErrors.cmake
Claus Klein d81a42450c - Add CMake Workflow Presets
- Upgrade to gitup workflow action v3
- Prepare use of git-flow
- Use CMake v3.21 variable PROJECT_IS_TOP_LEVEL
- Use CMAKE_DEBUG_POSTFIX to prevent name clashes
- Add more config files
2023-07-31 07:13:34 +02:00

16 lines
856 B
CMake

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()
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 14.0)
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated-declarations)
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()