Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ 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
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do those flags /MDd /Zi /Ob0 /Od /RTC1 /JMC come from? Are they default flags in CMake? Could you please add more details for maintaining them in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, those are the default flags in CMake. I will add a bit more detail and submit another PR soon.

set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1 /JMC")

add_definitions(-DWIN32)
add_definitions(-D_WIN32=1)
add_definitions(-DUNICODE -D_UNICODE)
Expand All @@ -22,7 +33,7 @@ if(WIN32)
add_compile_options($<$<CONFIG:Release>:/MT>)
add_compile_options($<$<CONFIG:RelWithDebInfo>:/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
Expand Down