Skip to content

Commit 05cd049

Browse files
authored
Merge pull request #7341 from rintaro/next-swift-swift-linux
[next][lldb][Swift][CMake] Correct RUNPATH in Linux builds
2 parents d808dc8 + 4292eac commit 05cd049

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

lldb/cmake/modules/AddLLDB.cmake

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,17 @@ function(add_properties_for_swift_modules target reldir)
229229
set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${SWIFT_INSTALL_RPATH}")
230230

231231
if (SWIFT_SWIFT_PARSER)
232-
set_property(TARGET ${target}
233-
APPEND PROPERTY BUILD_RPATH "@loader_path/${build_reldir}lib/swift/host")
234-
set_property(TARGET ${target}
235-
APPEND PROPERTY INSTALL_RPATH "@loader_path/${reldir}lib/swift/host")
232+
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
233+
set_property(TARGET ${target}
234+
APPEND PROPERTY BUILD_RPATH "@loader_path/${build_reldir}lib/swift/host")
235+
set_property(TARGET ${target}
236+
APPEND PROPERTY INSTALL_RPATH "@loader_path/${reldir}lib/swift/host")
237+
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux|Android|OpenBSD|FreeBSD")
238+
set_property(TARGET ${target}
239+
APPEND PROPERTY BUILD_RPATH "$ORIGIN/${build_reldir}lib/swift/host")
240+
set_property(TARGET ${target}
241+
APPEND PROPERTY INSTALL_RPATH "$ORIGIN/${reldir}lib/swift/host")
242+
endif()
236243
endif()
237244
endif()
238245
endfunction()

lldb/source/API/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ endif()
154154
# BEGIN Swift Mods
155155
# Note that add_properties_for_swift_modules appends RPATHs so it's critical
156156
# that this is called after lldb_setup_rpaths.
157-
add_properties_for_swift_modules(liblldb "../../../../../../usr/" "../../../../")
157+
if(LLDB_BUILD_FRAMEWORK)
158+
add_properties_for_swift_modules(liblldb "../../../../../../usr/" "../../../../")
159+
else()
160+
add_properties_for_swift_modules(liblldb "../")
161+
endif()
158162
# END Swift Mods
159163

160164
if(LLDB_ENABLE_PYTHON)

0 commit comments

Comments
 (0)