CMake: Pass various /Zc flags to MSVC for consistency with Base.props

969ea6e4f5

Fixes non-conformant handling of __VA_ARGS__.
This commit is contained in:
Léo Lam 2020-11-21 14:27:39 +01:00
parent fa73b1a23f
commit f53a7a2b66
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
1 changed files with 7 additions and 0 deletions

View File

@ -244,6 +244,13 @@ if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
add_compile_options(/volatile:iso)
# Fix non-conformant lambda behavior (constexpr variables shouldn't need capturing)
add_compile_options(/experimental:newLambdaProcessor)
# Fix various other non-conformant behaviors
add_compile_options(/Zc:externConstexpr,lambda,preprocessor)
# Temporarily disable warnings to enable /Zc:preprocessor compatibility with WinSDK headers.
add_compile_options(
/wd5105 # macro expansion producing 'defined' has undefined behavior
)
string(APPEND CMAKE_EXE_LINKER_FLAGS " /NXCOMPAT")
else()