Skip to content

Commit 795e889

Browse files
authored
[Clang][CMake][MSVC] Install PDBs alongside executables (#126961)
Fixes the changes introduced in #126675 and subsequently reverted by #126934 . Originally, I mistakenly put the `install` in the wrong location (should have been in the `add_clang_tool` macro) which slipped through testing. I've verified locally using the same CMake configure options. For reference: * **CMake Configure** ``` cmake -B build -S llvm -GNinja -DLLVM_ENABLE_PROJECTS="llvm;clang;lld;compiler-rt" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PDB=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl ``` * **Error** ``` TARGET_PDB_FILE is allowed only for targets with linker created artifacts. ```
1 parent e100f54 commit 795e889

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/cmake/modules/AddClang.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ macro(add_clang_tool name)
186186
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
187187
COMPONENT ${name})
188188

189+
if (LLVM_ENABLE_PDB)
190+
install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name} OPTIONAL)
191+
endif()
192+
189193
if(NOT LLVM_ENABLE_IDE)
190194
add_llvm_install_targets(install-${name}
191195
DEPENDS ${name}

0 commit comments

Comments
 (0)