From 4186d628e14260cfa6ab1cc900dc29d766dcafbe Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Wed, 15 Mar 2023 16:54:38 -0700 Subject: [PATCH] [CMake] Add lib to swift host libraries link directories Our libraries have a `LC_LINKER_OPTION` for eg. `-lswiftLLVMJSON`. This is resolved (probably just based on the actual libswiftLLVMJSON.a added to the link command) by ld, but not by lld. Add in a link directory so that these libraries can be found. --- cmake/modules/AddSwift.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake index 9977e5a904808..5b8365e930ce8 100644 --- a/cmake/modules/AddSwift.cmake +++ b/cmake/modules/AddSwift.cmake @@ -692,6 +692,8 @@ function(add_swift_host_library name) add_library(${name} ${libkind} ${ASHL_SOURCES}) + target_link_directories(${name} PUBLIC ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) + # Respect LLVM_COMMON_DEPENDS if it is set. # # LLVM_COMMON_DEPENDS if a global variable set in ./lib that provides targets