[llvm] [LLVM][CMake][MSVC] Install PDBs alongside executables (PR #120683)

Miguel A. Arroyo via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 14:10:13 PST 2024


https://github.com/mayanez updated https://github.com/llvm/llvm-project/pull/120683

>From 2c3e4a941126cfbaf9114e0850dc255e72eb7fd4 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 | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 54a54db338e695..7acc5ff0b7ee92 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1489,6 +1489,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 +1522,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 +1559,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