From 895f2f2e10c245a45880c07c2666d498e62d8ecf Mon Sep 17 00:00:00 2001 From: Shuqiao Zhang Date: Mon, 14 Apr 2025 19:00:29 +0800 Subject: [PATCH] Build PDB for debugging on Windows (#2685) * Build PDB for debugging on Windows * Update CMakeLists.txt --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c06b7df5..b45b7888 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -825,6 +825,12 @@ if(CAPSTONE_BUILD_SHARED_LIBS) $ ) target_compile_definitions(capstone PUBLIC CAPSTONE_SHARED) + # Build pdb file for dll on Windows + if(MSVC) + message("Enabling PDB for Windows") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG") + endif() endif() # Fuzzer if this is moved to it's own CMakeLists.txt (as it should be) @@ -951,6 +957,14 @@ if(CAPSTONE_INSTALL) DESTINATION ${CAPSTONE_CMAKE_CONFIG_INSTALL_DIR} ) + if (MSVC AND CAPSTONE_BUILD_SHARED_LIBS) + install(FILES + $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + OPTIONAL + ) + endif() + # uninstall target if(NOT TARGET UNINSTALL) configure_file(