Skip to content

Commit 1986f39

Browse files
authored
Merge pull request swiftlang#541 from buttaface/rpath
[CMake] fix runpath for ELF platforms
2 parents ae5c03e + 7dc982e commit 1986f39

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
155155
"-Xlinker -alias_list -Xlinker ${PROJECT_SOURCE_DIR}/xcodeconfig/libdispatch.aliases")
156156
endif()
157157

158+
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
159+
set_target_properties(dispatch PROPERTIES INSTALL_RPATH "$ORIGIN")
160+
endif()
161+
158162
if(ENABLE_SWIFT)
159163
add_subdirectory(swift)
160164
endif()

src/swift/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,7 @@ if(NOT BUILD_SHARED_LIBS)
5959
install(TARGETS DispatchStubs
6060
EXPORT dispatchExports
6161
DESTINATION ${INSTALL_TARGET_DIR})
62+
elseif(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
63+
target_link_options(swiftDispatch PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
64+
set_target_properties(swiftDispatch PROPERTIES INSTALL_RPATH "$ORIGIN")
6265
endif()

0 commit comments

Comments
 (0)