Skip to content

Commit 9d134f2

Browse files
authored
[LLVM][CMake][MSVC] Install PDBs alongside executables (#120683)
* When building on Windows hosts, PDBs aren't installed to the `CMAKE_INSTALL_PREFIX`. * This PR addresses it solely for `llvm-*` executables. * Similar changes are required in `AddClang.cmake`, `AddLLD.cmake`, etc. I'd be happy to queue those PRs after this one.
1 parent 3293bff commit 9d134f2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/cmake/modules/AddLLVM.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,11 @@ macro(llvm_add_tool project name)
14981498
${export_to_llvmexports}
14991499
RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
15001500
COMPONENT ${name})
1501+
if (LLVM_ENABLE_PDB)
1502+
install(FILES $<TARGET_PDB_FILE:${name}>
1503+
DESTINATION "${${project}_TOOLS_INSTALL_DIR}" COMPONENT ${name}
1504+
OPTIONAL)
1505+
endif()
15011506
15021507
if (NOT LLVM_ENABLE_IDE)
15031508
add_llvm_install_targets(install-${name}
@@ -1528,6 +1533,11 @@ macro(add_llvm_example name)
15281533
add_llvm_executable(${name} EXPORT_SYMBOLS ${ARGN})
15291534
if( LLVM_BUILD_EXAMPLES )
15301535
install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
1536+
if (LLVM_ENABLE_PDB)
1537+
install(FILES $<TARGET_PDB_FILE:${name}>
1538+
DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}" COMPONENT ${name}
1539+
OPTIONAL)
1540+
endif()
15311541
endif()
15321542
get_subproject_title(subproject_title)
15331543
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Examples")
@@ -1562,6 +1572,11 @@ macro(add_llvm_utility name)
15621572
${export_to_llvmexports}
15631573
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
15641574
COMPONENT ${name})
1575+
if (LLVM_ENABLE_PDB)
1576+
install(FILES $<TARGET_PDB_FILE:${name}>
1577+
DESTINATION "${LLVM_UTILS_INSTALL_DIR}" COMPONENT ${name}
1578+
OPTIONAL)
1579+
endif()
15651580
15661581
if (NOT LLVM_ENABLE_IDE)
15671582
add_llvm_install_targets(install-${name}

0 commit comments

Comments
 (0)