From fe25bf61e5f9956fed4dd6dd302b79a69d5ba75b Mon Sep 17 00:00:00 2001 From: "Harish S. Kulkarni" Date: Fri, 21 Jun 2019 01:56:57 -0700 Subject: [PATCH 1/2] Fixed build errors resulting from upgrade to VS2019 compilers --- src/Native/CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt index a814277e91..0c8e184517 100644 --- a/src/Native/CMakeLists.txt +++ b/src/Native/CMakeLists.txt @@ -8,6 +8,14 @@ set(RESOURCES) include_directories("${CMAKE_BINARY_DIR}/../../") if(WIN32) + # Clobber and reset the default C and CXX flags because + # CMake uses /ZI (Edit and Continue) for generating pdbs + # which is incompatible with the /guard:cf flag we set below + # for security. So we use the default flags set by CMake + # and reset /ZI with /Zi + set(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC") + set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC") + add_definitions(-DWIN32) add_definitions(-D_WIN32=1) add_definitions(-DUNICODE -D_UNICODE) @@ -22,7 +30,7 @@ if(WIN32) add_compile_options($<$:/MT>) add_compile_options($<$:/MT>) add_compile_options(/guard:cf) - add_compile_options(/d2Zi+) # make optimized builds debugging easier + add_compile_options(/Zo) # make optimized builds debugging easier. /Zo is the newer documented flag. add_compile_options(/nologo) # Suppress Startup Banner add_compile_options(/W3) # set warning level to 3 add_compile_options(/WX) # treat warnings as errors From cb446be57b5debba61f711ed55159e16ce575a1f Mon Sep 17 00:00:00 2001 From: "Harish S. Kulkarni" Date: Fri, 21 Jun 2019 09:44:22 -0700 Subject: [PATCH 2/2] Added additional message describing the previous fix --- src/Native/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Native/CMakeLists.txt b/src/Native/CMakeLists.txt index 0c8e184517..96345141b7 100644 --- a/src/Native/CMakeLists.txt +++ b/src/Native/CMakeLists.txt @@ -13,6 +13,9 @@ if(WIN32) # which is incompatible with the /guard:cf flag we set below # for security. So we use the default flags set by CMake # and reset /ZI with /Zi + message("CMAKE_C_FLAGS_DEBUG is ${CMAKE_C_FLAGS_DEBUG}") + message("CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}") + message("In a future version, If the default compiler flags no longer contain the /ZI flag, delete this message block and the two lines below.") set(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC") set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC")