@@ -8,6 +8,17 @@ set(RESOURCES)
8
8
include_directories ("${CMAKE_BINARY_DIR} /../../" )
9
9
10
10
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
16
+ 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" )
21
+
11
22
add_definitions (-DWIN32)
12
23
add_definitions (-D_WIN32=1)
13
24
add_definitions (-DUNICODE -D_UNICODE)
@@ -22,7 +33,7 @@ if(WIN32)
22
33
add_compile_options ($<$<CONFIG:Release>:/MT>)
23
34
add_compile_options ($<$<CONFIG:RelWithDebInfo>:/MT>)
24
35
add_compile_options (/guard:cf)
25
- add_compile_options (/d2Zi+ ) # make optimized builds debugging easier
36
+ add_compile_options (/Zo ) # make optimized builds debugging easier. /Zo is the newer documented flag.
26
37
add_compile_options (/nologo) # Suppress Startup Banner
27
38
add_compile_options (/W3) # set warning level to 3
28
39
add_compile_options (/WX) # treat warnings as errors
0 commit comments