Build PDB for debugging on Windows (#2685)

* Build PDB for debugging on Windows

* Update CMakeLists.txt
This commit is contained in:
Shuqiao Zhang 2025-04-14 19:00:29 +08:00 committed by GitHub
parent 5c3aef03ea
commit 895f2f2e10
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -825,6 +825,12 @@ if(CAPSTONE_BUILD_SHARED_LIBS)
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
)
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
$<TARGET_PDB_FILE:capstone_shared>
DESTINATION ${CMAKE_INSTALL_BINDIR}
OPTIONAL
)
endif()
# uninstall target
if(NOT TARGET UNINSTALL)
configure_file(