Skip to content

Commit c7a78ee

Browse files
committed
[lld][cmake] install symlinks when built standalone
lld installs symlinks with llvm_install_symlink, which relies on the variable LLVM_USE_SYMLINKS to determine whether to use symlinks or copies. Since that variable is defined in llvm's CMakeLists.txt, it may not be defined when lld is built standalone. In that case, default to using symlinks on Unix platforms. Users can still override this by setting LLVM_USE_SYMLINKS manually. Fixes #151557. Signed-off-by: Ruoyu Zhong <[email protected]>
1 parent b2574c9 commit c7a78ee

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lld/cmake/modules/AddLLD.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ macro(add_lld_tool name)
7373
endmacro()
7474

7575
macro(add_lld_symlink name dest)
76+
# In standalone builds, LLVM_USE_SYMLINKS may not be defined.
77+
# In that case, default to using symlinks on Unix platforms.
78+
if(NOT DEFINED LLVM_USE_SYMLINKS)
79+
set(LLVM_USE_SYMLINKS ${CMAKE_HOST_UNIX})
80+
endif()
7681
get_property(LLVM_DRIVER_TOOLS GLOBAL PROPERTY LLVM_DRIVER_TOOLS)
7782
if(LLVM_TOOL_LLVM_DRIVER_BUILD
7883
AND ${dest} IN_LIST LLVM_DRIVER_TOOLS

0 commit comments

Comments
 (0)