[llvm] [LLVM][CMake][MSVC] Install PDBs alongside executables (PR #120683)
Miguel A. Arroyo via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 20:37:06 PST 2024
https://github.com/mayanez created https://github.com/llvm/llvm-project/pull/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.
>From cb24db2e14313126345e75201e01037e38d5c6f2 Mon Sep 17 00:00:00 2001
From: Miguel Arroyo <miguel.arroyo at rockstargames.com>
Date: Thu, 19 Dec 2024 20:20:47 -0800
Subject: [PATCH] [LLVM][CMake][MSVC] Install PDBs alongside executables
---
llvm/cmake/modules/AddLLVM.cmake | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 54a54db338e695..e9119bc779d52c 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -973,6 +973,9 @@ macro(add_llvm_library name)
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
+ install(FILES $<TARGET_PDB_FILE:${name}>
+ DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name}
+ OPTIONAL)
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@@ -1489,6 +1492,9 @@ macro(llvm_add_tool project name)
${export_to_llvmexports}
RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
COMPONENT ${name})
+ install(FILES $<TARGET_PDB_FILE:${name}>
+ DESTINATION "${${project}_TOOLS_INSTALL_DIR}" COMPONENT ${name}
+ OPTIONAL)
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
@@ -1519,6 +1525,9 @@ macro(add_llvm_example name)
add_llvm_executable(${name} EXPORT_SYMBOLS ${ARGN})
if( LLVM_BUILD_EXAMPLES )
install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
+ install(FILES $<TARGET_PDB_FILE:${name}>
+ DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}" COMPONENT ${name}
+ OPTIONAL)
endif()
get_subproject_title(subproject_title)
set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Examples")
@@ -1553,6 +1562,9 @@ macro(add_llvm_utility name)
${export_to_llvmexports}
RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
COMPONENT ${name})
+ install(FILES $<TARGET_PDB_FILE:${name}>
+ DESTINATION "${LLVM_UTILS_INSTALL_DIR}" COMPONENT ${name}
+ OPTIONAL)
if (NOT LLVM_ENABLE_IDE)
add_llvm_install_targets(install-${name}
More information about the llvm-commits
mailing list