Skip to content

Commit 7875139

Browse files
authored
build: adjust the autolink library for Windows (#5215)
When building statically, ensure that we prefix the Swift libraries with the correct prefix to permit static linking of the libraries.
1 parent ae61520 commit 7875139

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Sources/Foundation/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ if(NOT BUILD_SHARED_LIBS)
161161
target_compile_options(Foundation PRIVATE
162162
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend _FoundationICU>")
163163
target_compile_options(Foundation PRIVATE
164-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
164+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend $<$<PLATFORM_ID:Windows>:${CMAKE_STATIC_LIBRARY_PREFIX_Swift}>swiftSynchronization>")
165165
endif()
166166

167167
if(dispatch_FOUND)

Sources/FoundationNetworking/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if(NOT BUILD_SHARED_LIBS)
6161
target_compile_options(FoundationNetworking PRIVATE
6262
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend curl>")
6363
target_compile_options(FoundationNetworking PRIVATE
64-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
64+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend $<$<PLATFORM_ID:Windows>:${CMAKE_STATIC_LIBRARY_PREFIX_Swift}>swiftSynchronization>")
6565

6666
if(BUILD_FULLY_STATIC)
6767
target_compile_options(FoundationNetworking

Sources/FoundationXML/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if(NOT BUILD_SHARED_LIBS)
3636
target_compile_options(FoundationXML PRIVATE
3737
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend xml2>")
3838
target_compile_options(FoundationXML PRIVATE
39-
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>")
39+
"SHELL:$<$<COMPILE_LANGUAGE:Swift>:-Xfrontend -public-autolink-library -Xfrontend $<$<PLATFORM_ID:Windows>:${CMAKE_STATIC_LIBRARY_PREFIX_Swift}>swiftSynchronization>")
4040

4141
if(BUILD_FULLY_STATIC)
4242
target_compile_options(FoundationXML

0 commit comments

Comments
 (0)