Skip to content

Commit 8b4dadc

Browse files
committed
[build] re-enable setting soname for Android shared libraries, as in #30020
1 parent 4560817 commit 8b4dadc

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
@@ -1324,14 +1324,8 @@ function(add_swift_target_library name)
13241324
list(APPEND swiftlib_link_flags_all "-Wl,-z,defs")
13251325
endif()
13261326
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
1327-
if(SWIFTLIB_SHARED)
1328-
if(sdk IN_LIST SWIFT_APPLE_PLATFORMS)
1329-
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
1330-
elseif(${sdk} STREQUAL ANDROID)
1331-
list(APPEND swiftlib_link_flags_all "-shared")
1332-
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
1333-
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
1334-
endif()
1327+
if(SWIFTLIB_SHARED AND sdk IN_LIST SWIFT_APPLE_PLATFORMS)
1328+
list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names")
13351329
endif()
13361330

13371331
set(sdk_supported_archs
@@ -1472,6 +1466,13 @@ function(add_swift_target_library name)
14721466

14731467
list(APPEND swiftlib_c_compile_flags_all "-DSWIFT_TARGET_LIBRARY_NAME=${name}")
14741468

1469+
# Setting back linker flags which are not supported when making Android build on macOS cross-compile host.
1470+
if(SWIFTLIB_SHARED AND ${sdk} STREQUAL ANDROID)
1471+
list(APPEND swiftlib_link_flags_all "-shared")
1472+
# TODO: Instead of `lib${name}.so` find variable or target property which already have this value.
1473+
list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so")
1474+
endif()
1475+
14751476
# Add this library variant.
14761477
_add_swift_target_library_single(
14771478
${variant_name}

0 commit comments

Comments
 (0)