Skip to content

Commit 9cd0b8e

Browse files
harishskeerhardt
authored andcommitted
Checked in a better fix based on code review (#3896)
* Fixed build errors resulting from upgrade to VS2019 compilers * Added additional message describing the previous fix * Checked in a better fix based on code review * Updated message
1 parent e66e19e commit 9cd0b8e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Native/CMakeLists.txt

+5-9
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@ set(RESOURCES)
88
include_directories("${CMAKE_BINARY_DIR}/../../")
99

1010
if(WIN32)
11-
# Clobber and reset the default C and CXX flags because
12-
# CMake uses /ZI (Edit and Continue) for generating pdbs
13-
# which is incompatible with the /guard:cf flag we set below
14-
# for security. So we use the default flags set by CMake
15-
# and reset /ZI with /Zi
11+
# There seems to be a bug in the latest VS2019
12+
# which is adding /ZI (which conflicts with /guard:cf) instead of /Zi.
1613
message("CMAKE_C_FLAGS_DEBUG is ${CMAKE_C_FLAGS_DEBUG}")
17-
message("CMAKE_CXX_FLAGS_DEBUG is ${CMAKE_CXX_FLAGS_DEBUG}")
18-
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.")
19-
set(CMAKE_C_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC")
20-
set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC")
14+
message("In a future version, if the CMake that ships with VS2019 no longer contains the /ZI flag, delete this message block and the two lines below.")
15+
string(REPLACE "/ZI" "/Zi" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
16+
string(REPLACE "/ZI" "/Zi" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
2117

2218
add_definitions(-DWIN32)
2319
add_definitions(-D_WIN32=1)

0 commit comments

Comments
 (0)