[llvm] 9d134f2 - [LLVM][CMake][MSVC] Install PDBs alongside executables (#120683)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 21:40:54 PST 2025


Author: Miguel A. Arroyo
Date: 2025-02-10T21:40:51-08:00
New Revision: 9d134f26ea83cd53e7b38220c2b95d6f20ba3221

URL: https://github.com/llvm/llvm-project/commit/9d134f26ea83cd53e7b38220c2b95d6f20ba3221
DIFF: https://github.com/llvm/llvm-project/commit/9d134f26ea83cd53e7b38220c2b95d6f20ba3221.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/cmake/modules/AddLLVM.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index baf47677b247cd7..39f0e28a249d3c6 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1498,6 +1498,11 @@ macro(llvm_add_tool project name)
                 ${export_to_llvmexports}
                 RUNTIME DESTINATION ${${project}_TOOLS_INSTALL_DIR}
                 COMPONENT ${name})
+        if (LLVM_ENABLE_PDB)
+          install(FILES $<TARGET_PDB_FILE:${name}> 
+                DESTINATION "${${project}_TOOLS_INSTALL_DIR}" COMPONENT ${name} 
+                OPTIONAL)
+        endif()
 
         if (NOT LLVM_ENABLE_IDE)
           add_llvm_install_targets(install-${name}
@@ -1528,6 +1533,11 @@ 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}")
+    if (LLVM_ENABLE_PDB)
+      install(FILES $<TARGET_PDB_FILE:${name}> 
+              DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}" COMPONENT ${name} 
+              OPTIONAL)
+    endif()
   endif()
   get_subproject_title(subproject_title)
   set_target_properties(${name} PROPERTIES FOLDER "${subproject_title}/Examples")
@@ -1562,6 +1572,11 @@ macro(add_llvm_utility name)
               ${export_to_llvmexports}
               RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
               COMPONENT ${name})
+      if (LLVM_ENABLE_PDB)
+        install(FILES $<TARGET_PDB_FILE:${name}> 
+                DESTINATION "${LLVM_UTILS_INSTALL_DIR}" COMPONENT ${name} 
+                OPTIONAL)
+      endif()
 
       if (NOT LLVM_ENABLE_IDE)
         add_llvm_install_targets(install-${name}


        


More information about the llvm-commits mailing list