Skip to content

Commit ad95b5f

Browse files
committed
Use analogous rpath settings for Swift libraries on Linux
This was defaulting to the build directory, which isn't helpful post-install. Set Swift libraries to look in the same directory (ORIGIN) or /usr/lib/swift/linux. rdar://problem/22766758
1 parent 59092a3 commit ad95b5f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,14 @@ function(_add_swift_library_single target name)
888888

889889
set_target_properties("${target}"
890890
PROPERTIES
891-
INSTALL_NAME_DIR "${install_name_dir}"
892-
BUILD_WITH_INSTALL_RPATH YES)
891+
INSTALL_NAME_DIR "${install_name_dir}")
892+
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
893+
set_target_properties("${target}"
894+
PROPERTIES
895+
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux")
893896
endif()
894897

898+
set_target_properties("${target}" PROPERTIES BUILD_WITH_INSTALL_RPATH YES)
895899
set_target_properties("${target}" PROPERTIES FOLDER "Swift libraries")
896900

897901
# Configure the static library target.

0 commit comments

Comments
 (0)