From fbe8a6d215667950bfc7f2e3e6cc2b3b8d4a399e Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Thu, 22 May 2025 12:32:31 -0700 Subject: [PATCH] build: adjust the autolink library for Windows When building statically, ensure that we prefix the Swift libraries with the correct prefix to permit static linking of the libraries. --- Sources/Foundation/CMakeLists.txt | 2 +- Sources/FoundationNetworking/CMakeLists.txt | 2 +- Sources/FoundationXML/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Foundation/CMakeLists.txt b/Sources/Foundation/CMakeLists.txt index f6299e5c90..c901e5ab24 100644 --- a/Sources/Foundation/CMakeLists.txt +++ b/Sources/Foundation/CMakeLists.txt @@ -161,7 +161,7 @@ if(NOT BUILD_SHARED_LIBS) target_compile_options(Foundation PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend _FoundationICU>") target_compile_options(Foundation PRIVATE - "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>") + "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend $<$:${CMAKE_STATIC_LIBRARY_PREFIX_Swift}>swiftSynchronization>") endif() if(dispatch_FOUND) diff --git a/Sources/FoundationNetworking/CMakeLists.txt b/Sources/FoundationNetworking/CMakeLists.txt index ec0818baeb..88de57ca2c 100644 --- a/Sources/FoundationNetworking/CMakeLists.txt +++ b/Sources/FoundationNetworking/CMakeLists.txt @@ -61,7 +61,7 @@ if(NOT BUILD_SHARED_LIBS) target_compile_options(FoundationNetworking PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend curl>") target_compile_options(FoundationNetworking PRIVATE - "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>") + "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend $<$:${CMAKE_STATIC_LIBRARY_PREFIX_Swift}>swiftSynchronization>") if(BUILD_FULLY_STATIC) target_compile_options(FoundationNetworking diff --git a/Sources/FoundationXML/CMakeLists.txt b/Sources/FoundationXML/CMakeLists.txt index bb3f78bf4d..74aed77a33 100644 --- a/Sources/FoundationXML/CMakeLists.txt +++ b/Sources/FoundationXML/CMakeLists.txt @@ -36,7 +36,7 @@ if(NOT BUILD_SHARED_LIBS) target_compile_options(FoundationXML PRIVATE "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend xml2>") target_compile_options(FoundationXML PRIVATE - "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend swiftSynchronization>") + "SHELL:$<$:-Xfrontend -public-autolink-library -Xfrontend $<$:${CMAKE_STATIC_LIBRARY_PREFIX_Swift}>swiftSynchronization>") if(BUILD_FULLY_STATIC) target_compile_options(FoundationXML