From fffe2c0a2b4c22625848371e9596f07e235a262a Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Mon, 5 Jun 2017 23:22:01 -0700 Subject: [PATCH] cmake: enable same conformance-related flags as msbuild --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee1695c221..686a29e525 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)