Skip to content

Commit e265d39

Browse files
committed
Autolink static libraries in static swift build
1 parent 8731753 commit e265d39

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

Sources/Foundation/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,13 @@ target_link_libraries(Foundation
155155
FoundationEssentials
156156
FoundationInternationalization)
157157

158+
if(NOT BUILD_SHARED_LIBS)
159+
target_compile_options(Foundation PRIVATE
160+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend CoreFoundation>")
161+
target_compile_options(Foundation PRIVATE
162+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _FoundationICU>")
163+
endif()
164+
158165
target_link_options(Foundation PRIVATE
159166
"SHELL:-no-toolchain-stdlib-rpath")
160167

Sources/FoundationNetworking/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ target_link_libraries(FoundationNetworking
5656
PUBLIC
5757
Foundation)
5858

59+
if(NOT BUILD_SHARED_LIBS)
60+
target_compile_options(FoundationNetworking PRIVATE
61+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _CFURLSessionInterface>")
62+
target_compile_options(FoundationNetworking PRIVATE
63+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend CoreFoundation>")
64+
target_compile_options(FoundationNetworking PRIVATE
65+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend curl>")
66+
endif()
67+
5968
target_link_options(FoundationNetworking PRIVATE
6069
"SHELL:-no-toolchain-stdlib-rpath")
6170

Sources/FoundationXML/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ target_link_libraries(FoundationXML
3131
PUBLIC
3232
Foundation)
3333

34+
if(NOT BUILD_SHARED_LIBS)
35+
target_compile_options(FoundationXML PRIVATE
36+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _CFXMLInterface>")
37+
target_compile_options(FoundationXML PRIVATE
38+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend CoreFoundation>")
39+
target_compile_options(FoundationXML PRIVATE
40+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend xml2>")
41+
endif()
42+
3443
target_link_options(FoundationXML PRIVATE
3544
"SHELL:-no-toolchain-stdlib-rpath")
3645

0 commit comments

Comments
 (0)