Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c1e68e0

Browse files
committed
Allow generating PDB in Release builds
1 parent 730fd43 commit c1e68e0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
2424
include_directories(BEFORE SYSTEM ${DISPATCH_INCLUDES})
2525
dispatch_windows_lib_for_arch(${CMAKE_SYSTEM_PROCESSOR} DISPATCH_LIBDIR)
2626
link_directories(${DISPATCH_LIBDIR})
27+
28+
option(DISPATCH_ENABLE_PDB OFF)
29+
if (DISPATCH_ENABLE_PDB AND CMAKE_BUILD_TYPE STREQUAL "Release")
30+
function(append value)
31+
foreach(variable ${ARGN})
32+
set(${variable} "${${variable}} ${value}" PARENT_SCOPE)
33+
endforeach(variable)
34+
endfunction()
35+
36+
append("/Zi" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
37+
# /DEBUG disables linker GC and ICF, but we want those in Release mode.
38+
append("/DEBUG /OPT:REF /OPT:ICF"
39+
CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS
40+
CMAKE_SHARED_LINKER_FLAGS)
41+
endif()
2742
endif()
2843

2944
set(CMAKE_C_STANDARD 11)

0 commit comments

Comments
 (0)