cmake: enable same conformance-related flags as msbuild

This commit is contained in:
Shawn Hoffman 2017-06-05 23:22:01 -07:00
parent f018d69bff
commit fffe2c0a2b
1 changed files with 9 additions and 0 deletions

View File

@ -217,6 +217,15 @@ if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
check_and_add_flag(EXCEPTIONS /EHsc)
dolphin_compile_definitions(_DEBUG DEBUG_ONLY)
# Enforce C++ standard conforming conversion rules to catch possible bugs
add_compile_options(/permissive-)
# Remove unreferenced inline functions/data to reduce link time and catch bugs
add_compile_options(/Zc:inline)
# Assume `new` (w/o std::nothrow) throws to reduce binary size
add_compile_options(/Zc:throwingNew)
# Enforce strict volatile semantics as per ISO C++
add_compile_options(/volatile:iso)
string(APPEND CMAKE_EXE_LINKER_FLAGS " /NXCOMPAT")
else()
add_definitions(-D_DEFAULT_SOURCE)