From 50c34f9a523a348ff7e40dcaf0cca9d53f94468f Mon Sep 17 00:00:00 2001 From: Eric Miotto <1094986+edymtt@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:42:36 -0700 Subject: [PATCH] =?UTF-8?q?[=F0=9F=8D=92/20240408]=20LLDB=20CMake:=20add?= =?UTF-8?q?=20option=20to=20link=20Swift=20content=20from=20Darwin=20toolc?= =?UTF-8?q?hain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a companion to https://github.com/apple/swift/pull/73255, and it's needed in some Apple internal configurations. Addresses rdar://127113448 (cherry picked from commit ead278fb4d62a7282a15105fc8fbdb2c11a0cf08) --- lldb/cmake/modules/AddLLDB.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake index 5c835769bff96..0822397fce8bd 100644 --- a/lldb/cmake/modules/AddLLDB.cmake +++ b/lldb/cmake/modules/AddLLDB.cmake @@ -244,6 +244,11 @@ function(add_properties_for_swift_modules target reldir) APPEND PROPERTY BUILD_RPATH "@loader_path/${build_reldir}lib/swift/host") set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "@loader_path/${reldir}lib/swift/host") + if(SWIFT_ALLOW_LINKING_SWIFT_CONTENT_IN_DARWIN_TOOLCHAIN) + get_filename_component(TOOLCHAIN_BIN_DIR ${CMAKE_Swift_COMPILER} DIRECTORY) + get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/macosx" ABSOLUTE) + target_link_directories(${target} BEFORE PUBLIC ${TOOLCHAIN_LIB_DIR}) + endif() elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OpenBSD|FreeBSD") set_property(TARGET ${target} APPEND PROPERTY BUILD_RPATH "$ORIGIN/${build_reldir}lib/swift/host")