Skip to content

Commit 9ceb356

Browse files
Merge private dependencies into single static library
1 parent eec4b26 commit 9ceb356

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

Sources/Foundation/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,20 @@ set_target_properties(Foundation PROPERTIES
160160
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift
161161
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/swift)
162162

163+
if(NOT BUILD_SHARED_LIBS)
164+
# TODO(katei): Comment out after swift-frontend implementation
165+
# https://github.com/apple/swift/pull/35936
166+
# target_compile_options(Foundation
167+
# PRIVATE
168+
# "SHELL:-public-autolink-library icui18n")
169+
170+
# Merge private dependencies into single static objects archive
171+
set_property(TARGET Foundation PROPERTY STATIC_LIBRARY_OPTIONS
172+
$<TARGET_OBJECTS:CoreFoundation>
173+
$<TARGET_OBJECTS:uuid>
174+
$<TARGET_OBJECTS:BlocksRuntime>)
175+
endif()
176+
163177
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
164178
# NOTE: workaround for CMake which doesn't link in OBJECT libraries properly
165179
add_dependencies(Foundation CoreFoundationResources)

Sources/FoundationNetworking/CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ target_link_libraries(FoundationNetworking
6464
CFURLSessionInterface
6565
PUBLIC
6666
Foundation)
67+
68+
if(NOT BUILD_SHARED_LIBS)
69+
# TODO(katei): Comment out after swift-frontend implementation
70+
# https://github.com/apple/swift/pull/35936
71+
# target_compile_options(FoundationNetworking
72+
# PRIVATE
73+
# "SHELL:-public-autolink-library curl")
74+
75+
# Merge private dependencies into single static objects archive
76+
set_property(TARGET FoundationNetworking PROPERTY STATIC_LIBRARY_OPTIONS
77+
$<TARGET_OBJECTS:CFURLSessionInterface>)
78+
endif()
79+
6780
set_target_properties(FoundationNetworking PROPERTIES
6881
INSTALL_RPATH "$ORIGIN"
6982
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift

Sources/FoundationXML/CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ target_link_libraries(FoundationXML
1616
CFXMLInterface
1717
PUBLIC
1818
Foundation)
19+
20+
if(NOT BUILD_SHARED_LIBS)
21+
# TODO(katei): Comment out after swift-frontend implementation
22+
# https://github.com/apple/swift/pull/35936
23+
# target_compile_options(FoundationXML
24+
# PRIVATE
25+
# "SHELL:-public-autolink-library xml2")
26+
27+
# Merge private dependencies into single static objects archive
28+
set_property(TARGET FoundationXML PROPERTY STATIC_LIBRARY_OPTIONS
29+
$<TARGET_OBJECTS:CFXMLInterface>)
30+
endif()
31+
1932
set_target_properties(FoundationXML PROPERTIES
2033
INSTALL_RPATH "$ORIGIN"
2134
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift

0 commit comments

Comments
 (0)