[PATCH] D140534: Properly support LLVM_ENABLE_LLD on Windows
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 22 11:07:52 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8d3ab9dfc4d4: Properly support LLVM_ENABLE_LLD on Windows (authored by serge-sans-paille).
Changed prior to commit:
https://reviews.llvm.org/D140534?vs=484770&id=484896#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140534/new/
https://reviews.llvm.org/D140534
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -293,10 +293,23 @@
if ( LLVM_USE_LINKER )
message(FATAL_ERROR "LLVM_ENABLE_LLD and LLVM_USE_LINKER can't be set at the same time")
endif()
+
# In case of MSVC cmake always invokes the linker directly, so the linker
# should be specified by CMAKE_LINKER cmake variable instead of by -fuse-ld
# compiler option.
- if ( NOT MSVC )
+ if ( MSVC )
+ if(NOT CMAKE_LINKER MATCHES "lld-link")
+ get_filename_component(CXX_COMPILER_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
+ get_filename_component(C_COMPILER_DIR ${CMAKE_C_COMPILER} DIRECTORY)
+ find_program(LLD_LINK NAMES "lld-link" "lld-link.exe" HINTS ${CXX_COMPILER_DIR} ${C_COMPILER_DIR} DOC "lld linker")
+ if(NOT LLD_LINK)
+ message(FATAL_ERROR
+ "LLVM_ENABLE_LLD set, but cannot find lld-link. "
+ "Consider setting CMAKE_LINKER to lld-link path.")
+ endif()
+ set(CMAKE_LINKER ${LLD_LINK})
+ endif()
+ else()
set(LLVM_USE_LINKER "lld")
endif()
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140534.484896.patch
Type: text/x-patch
Size: 1234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221222/27572b57/attachment.bin>
More information about the llvm-commits
mailing list