diff --git a/lldb/cmake/modules/AddLLDB.cmake b/lldb/cmake/modules/AddLLDB.cmake index 55179762db7fc..8660bb5d1449b 100644 --- a/lldb/cmake/modules/AddLLDB.cmake +++ b/lldb/cmake/modules/AddLLDB.cmake @@ -202,10 +202,17 @@ function(add_properties_for_swift_modules target reldir) set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${SWIFT_INSTALL_RPATH}") if (SWIFT_SWIFT_PARSER) - set_property(TARGET ${target} - 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 (CMAKE_SYSTEM_NAME MATCHES "Darwin") + set_property(TARGET ${target} + 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") + elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OpenBSD|FreeBSD") + set_property(TARGET ${target} + APPEND PROPERTY BUILD_RPATH "$ORIGIN/${build_reldir}lib/swift/host") + set_property(TARGET ${target} + APPEND PROPERTY INSTALL_RPATH "$ORIGIN/${reldir}lib/swift/host") + endif() endif() endif() endfunction() diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt index a7cc725c4f6e2..0ae67bd241bcb 100644 --- a/lldb/source/API/CMakeLists.txt +++ b/lldb/source/API/CMakeLists.txt @@ -149,7 +149,11 @@ endif() # BEGIN Swift Mods # Note that add_properties_for_swift_modules appends RPATHs so it's critical # that this is called after lldb_setup_rpaths. -add_properties_for_swift_modules(liblldb "../../../../../../usr/" "../../../../") +if(LLDB_BUILD_FRAMEWORK) + add_properties_for_swift_modules(liblldb "../../../../../../usr/" "../../../../") +else() + add_properties_for_swift_modules(liblldb "../") +endif() # END Swift Mods if(LLDB_ENABLE_PYTHON)