Skip to content

Commit 6f44558

Browse files
authored
Merge pull request #30235 from buttaface/rpath
[build][android] set INSTALL_RPATH properly for shared libraries
2 parents 8625aa5 + 4bfbfe9 commit 6f44558

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -624,14 +624,9 @@ function(_add_swift_host_library_single target)
624624
PROPERTIES
625625
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/cygwin")
626626
elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "ANDROID")
627-
# Only set the install RPATH if cross-compiling the host tools, in which
628-
# case both the NDK and Sysroot paths must be set.
629-
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" AND
630-
NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
631-
set_target_properties("${target}"
632-
PROPERTIES
633-
INSTALL_RPATH "$ORIGIN")
634-
endif()
627+
set_target_properties("${target}"
628+
PROPERTIES
629+
INSTALL_RPATH "$ORIGIN")
635630
endif()
636631

637632
set_target_properties("${target}" PROPERTIES BUILD_WITH_INSTALL_RPATH YES)

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,10 +958,9 @@ function(_add_swift_target_library_single target name)
958958
if(SWIFTLIB_SINGLE_TARGET_LIBRARY)
959959
set_target_properties("${target}" PROPERTIES NO_SONAME TRUE)
960960
endif()
961-
# Only set the install RPATH if cross-compiling the host tools, in which
962-
# case both the NDK and Sysroot paths must be set.
963-
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "" AND
964-
NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
961+
# Only set the install RPATH if the toolchain and stdlib will be in Termux
962+
# or some other native sysroot on Android.
963+
if(NOT "${SWIFT_ANDROID_NATIVE_SYSROOT}" STREQUAL "")
965964
set_target_properties("${target}"
966965
PROPERTIES
967966
INSTALL_RPATH "$ORIGIN")

0 commit comments

Comments
 (0)