Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.

Commit 74b0c7e

Browse files
committed
Generate PDB files on CMake release builds
1 parent 7e8c0e5 commit 74b0c7e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME}
3434
Dbghelp winmm comctl32 dsound dxguid Version)
3535

3636

37+
# Generating .pdb files
38+
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_BUILD_TYPE MATCHES "Release")
39+
target_compile_options(${PROJECT_NAME} PRIVATE /Zi)
40+
41+
# Tell linker to include symbol data
42+
set_target_properties(${PROJECT_NAME} PROPERTIES
43+
LINK_FLAGS "/INCREMENTAL:NO /DEBUG /OPT:REF /OPT:ICF"
44+
)
45+
46+
# Set file name & location
47+
set_target_properties(${PROJECT_NAME} PROPERTIES
48+
COMPILE_PDB_NAME ${PROJECT_NAME}
49+
COMPILE_PDB_OUTPUT_DIR ${CMAKE_BINARY_DIR}
50+
)
51+
endif()
52+
53+
3754
# 0CC-FamiTracker.rc includes res/0CC-FamiTracker.manifest.
3855
# To prevent manifest linking errors:
3956
# - res/0CC-FamiTracker.manifest MUST not be in add_executable().

0 commit comments

Comments
 (0)