mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[cmake] msvc.cmake: Add more conformance options.
FIx an error in the non-clang section that caused the common conformance flags to be overwritten with the MSVC-only flags. Not sure if this will break anything, and I can't build with MSVC at the moment... Move "/Zc:throwingNew" into the same non-clang-cl block as the other options.
This commit is contained in:
parent
ecc15f0372
commit
62aeead210
@ -106,9 +106,12 @@ ENDIF()
|
||||
|
||||
# MSVC: C++ conformance settings
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
SET(CXX_CONFORMANCE_FLAGS "/Zc:__cplusplus" "/Zc:rvalueCast" "/Zc:ternary")
|
||||
SET(CXX_CONFORMANCE_FLAGS "/Zc:__cplusplus" "/Zc:checkGwOdr" "/Zc:rvalueCast" "/Zc:templateScope" "/Zc:ternary")
|
||||
IF(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
SET(CXX_CONFORMANCE_FLAGS "/Zc:externC" "/Zc:noexceptTypes")
|
||||
# clang-cl enables certain conformance options by default,
|
||||
# and these cause warnings to be printed if specified.
|
||||
# Only enable these for original MSVC.
|
||||
SET(CXX_CONFORMANCE_FLAGS ${CXX_CONFORMANCE_FLAGS} "/Zc:externC" "/Zc:noexceptTypes" "/Zc:throwingNew")
|
||||
ENDIF(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
FOREACH(FLAG_TEST ${CXX_CONFORMANCE_FLAGS})
|
||||
# CMake doesn't like certain characters in variable names.
|
||||
@ -121,18 +124,6 @@ FOREACH(FLAG_TEST ${CXX_CONFORMANCE_FLAGS})
|
||||
UNSET(CXXFLAG_${FLAG_TEST_VARNAME})
|
||||
ENDFOREACH()
|
||||
|
||||
# "/Zc:throwingNew" is always enabled on clang-cl, and causes
|
||||
# warnings to be printed if it's specified.
|
||||
# NOTE: "/Zc:throwingNew" was added in MSVC 2015.
|
||||
IF(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("/Zc:throwingNew" CXXFLAG__Zc_throwingNew)
|
||||
IF(CXXFLAG__Zc_throwingNew)
|
||||
SET(RP_CXX_FLAGS_COMMON "${RP_CXX_FLAGS_COMMON} /Zc:throwingNew")
|
||||
ENDIF(CXXFLAG__Zc_throwingNew)
|
||||
UNSET(CXXFLAG__Zc_throwingNew)
|
||||
ENDIF(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
|
||||
# Disable warning C4996 (deprecated), then re-enable it.
|
||||
# Otherwise, it gets handled as an error due to /sdl.
|
||||
SET(RP_C_FLAGS_COMMON "${RP_C_FLAGS_COMMON} /wd4996 /w34996")
|
||||
|
Loading…
Reference in New Issue
Block a user