Skip to content

Commit 93da1a4

Browse files
authored
Merge pull request #30956 from buttaface/soname
[build] re-enable setting soname for Android shared libraries
2 parents 342e53f + 8b4dadc commit 93da1a4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,14 +1755,8 @@ function(add_swift_target_library name)
17551755
list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
17561756
endif()
17571757
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
1758-
if(SWIFTLIB_SHARED)
1759-
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
1760-
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
1761-
elseif(${sdk} STREQUAL ANDROID)
1762-
list(APPEND swiftlib_link_flags_all "-shared")
1763-
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
1764-
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
1765-
endif()
1758+
if(SWIFTLIB_SHARED AND sdk IN_LIST SWIFT_APPLE_PLATFORMS)
1759+
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
17661760
endif()
17671761

17681762
set(sdk_supported_archs
@@ -1903,6 +1897,13 @@ function(add_swift_target_library name)
19031897

19041898
list(APPEND swiftlib_c_compile_flags_all "-DSWIFT_TARGET_LIBRARY_NAME=${name}")
19051899

1900+
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
1901+
if(SWIFTLIB_SHARED AND ${sdk} STREQUAL ANDROID)
1902+
list(APPEND swiftlib_link_flags_all "-shared")
1903+
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
1904+
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
1905+
endif()
1906+
19061907
# Add this library variant.
19071908
_add_swift_target_library_single(
19081909
${variant_name}

0 commit comments

Comments
 (0)