From 8b4dadcda1718fe49c867aec7e262d4a9a262ede Mon Sep 17 00:00:00 2001 From: Butta Date: Fri, 10 Apr 2020 22:22:51 +0530 Subject: [PATCH] [build] re-enable setting soname for Android shared libraries, as in #30020 --- stdlib/cmake/modules/AddSwiftStdlib.cmake | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake index 3e0f799def8cd..8d272119fbd26 100644 --- a/stdlib/cmake/modules/AddSwiftStdlib.cmake +++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake @@ -1324,14 +1324,8 @@ function(add_swift_target_library name) list(APPEND swiftlib_link_flags_all "-Wl,-z,defs") endif() # Setting back linker flags which are not supported when making Android build on macOS cross-compile host. - if(SWIFTLIB_SHARED) - if(sdk IN_LIST SWIFT_APPLE_PLATFORMS) - list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names") - elseif(${sdk} STREQUAL ANDROID) - list(APPEND swiftlib_link_flags_all "-shared") - # TODO: Instead of `lib${name}.so` find variable or target property which already have this value. - list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so") - endif() + if(SWIFTLIB_SHARED AND sdk IN_LIST SWIFT_APPLE_PLATFORMS) + list(APPEND swiftlib_link_flags_all "-dynamiclib -Wl,-headerpad_max_install_names") endif() set(sdk_supported_archs @@ -1472,6 +1466,13 @@ function(add_swift_target_library name) list(APPEND swiftlib_c_compile_flags_all "-DSWIFT_TARGET_LIBRARY_NAME=${name}") + # Setting back linker flags which are not supported when making Android build on macOS cross-compile host. + if(SWIFTLIB_SHARED AND ${sdk} STREQUAL ANDROID) + list(APPEND swiftlib_link_flags_all "-shared") + # TODO: Instead of `lib${name}.so` find variable or target property which already have this value. + list(APPEND swiftlib_link_flags_all "-Wl,-soname,lib${name}.so") + endif() + # Add this library variant. _add_swift_target_library_single( ${variant_name}