Skip to content

Commit 895f2f2

Browse files
Build PDB for debugging on Windows (#2685)
* Build PDB for debugging on Windows * Update CMakeLists.txt
1 parent 5c3aef0 commit 895f2f2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,12 @@ if(CAPSTONE_BUILD_SHARED_LIBS)
825825
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
826826
)
827827
target_compile_definitions(capstone PUBLIC CAPSTONE_SHARED)
828+
# Build pdb file for dll on Windows
829+
if(MSVC)
830+
message("Enabling PDB for Windows")
831+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
832+
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
833+
endif()
828834
endif()
829835

830836
# Fuzzer if this is moved to it's own CMakeLists.txt (as it should be)
@@ -951,6 +957,14 @@ if(CAPSTONE_INSTALL)
951957
DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR}
952958
)
953959

960+
if (MSVC AND CAPSTONE_BUILD_SHARED_LIBS)
961+
install(FILES
962+
$<TARGET_PDB_FILE:capstone_shared>
963+
DESTINATION ${CMAKE_INSTALL_BINDIR}
964+
OPTIONAL
965+
)
966+
endif()
967+
954968
# uninstall target
955969
if(NOT TARGET UNINSTALL)
956970
configure_file(

0 commit comments

Comments
 (0)