diff --git a/Sources/Foundation/CMakeLists.txt b/Sources/Foundation/CMakeLists.txt index 016bf2946f..38b47f0947 100644 --- a/Sources/Foundation/CMakeLists.txt +++ b/Sources/Foundation/CMakeLists.txt @@ -160,6 +160,18 @@ set_target_properties(Foundation PROPERTIES Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift) +if(NOT BUILD_SHARED_LIBS) + target_compile_options(Foundation + PRIVATE + "SHELL:-Xfrontend -public-autolink-library -Xfrontend icui18n + -Xfrontend -public-autolink-library -Xfrontend BlocksRuntime") + + # Merge private dependencies into single static objects archive + set_property(TARGET Foundation PROPERTY STATIC_LIBRARY_OPTIONS + $ + $) +endif() + if(CMAKE_SYSTEM_NAME STREQUAL Windows) # NOTE: workaround for CMake which doesn't link in OBJECT libraries properly add_dependencies(Foundation CoreFoundationResources) diff --git a/Sources/FoundationNetworking/CMakeLists.txt b/Sources/FoundationNetworking/CMakeLists.txt index 164ef63b91..c1462d1dc0 100644 --- a/Sources/FoundationNetworking/CMakeLists.txt +++ b/Sources/FoundationNetworking/CMakeLists.txt @@ -64,6 +64,17 @@ target_link_libraries(FoundationNetworking CFURLSessionInterface PUBLIC Foundation) + +if(NOT BUILD_SHARED_LIBS) + target_compile_options(FoundationNetworking + PRIVATE + "SHELL:-Xfrontend -public-autolink-library -Xfrontend curl") + + # Merge private dependencies into single static objects archive + set_property(TARGET FoundationNetworking PROPERTY STATIC_LIBRARY_OPTIONS + $) +endif() + set_target_properties(FoundationNetworking PROPERTIES INSTALL_RPATH "$ORIGIN" Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift diff --git a/Sources/FoundationXML/CMakeLists.txt b/Sources/FoundationXML/CMakeLists.txt index cbc1a95ba3..913c8f42b3 100644 --- a/Sources/FoundationXML/CMakeLists.txt +++ b/Sources/FoundationXML/CMakeLists.txt @@ -16,6 +16,17 @@ target_link_libraries(FoundationXML CFXMLInterface PUBLIC Foundation) + +if(NOT BUILD_SHARED_LIBS) + target_compile_options(FoundationXML + PRIVATE + "SHELL:-Xfrontend -public-autolink-library -Xfrontend xml2") + + # Merge private dependencies into single static objects archive + set_property(TARGET FoundationXML PROPERTY STATIC_LIBRARY_OPTIONS + $) +endif() + set_target_properties(FoundationXML PROPERTIES INSTALL_RPATH "$ORIGIN" Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift