Skip to content

Build PDB for debugging on Windows #2685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
Loading