From e5b9f892562c020c9379cd81e8906fbb228f8e2d Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 15 Sep 2023 13:52:23 -0700 Subject: [PATCH] build: adjust the build for rebranch The newer clang compiler prefers `module.modulemap` over `module.map`. This will result in us using the framework form of the module definitions for CoreFoundation. While this is fine for the compilation, the linker directive to link against the framework will also be emitted into the object files. This causes a linker failure on Windows as `-framework (CoreFoundation|CFURLInterface|CFXMLInterface)` is not a valid linker option. Use the swift control over the directives to avoid emitting the framework link directive to repair the build. --- Sources/Foundation/CMakeLists.txt | 1 + Sources/FoundationNetworking/CMakeLists.txt | 1 + Sources/FoundationXML/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/Sources/Foundation/CMakeLists.txt b/Sources/Foundation/CMakeLists.txt index 398fbfc5e9..fc093ce0c8 100644 --- a/Sources/Foundation/CMakeLists.txt +++ b/Sources/Foundation/CMakeLists.txt @@ -152,6 +152,7 @@ target_compile_definitions(Foundation PRIVATE DEPLOYMENT_RUNTIME_SWIFT) target_compile_options(Foundation PUBLIC $<$:-enable-testing> + "SHELL:-Xfrontend -disable-autolink-framework -Xfrontend CoreFoundation" "SHELL:-Xcc -F${CMAKE_BINARY_DIR}") target_link_libraries(Foundation PRIVATE diff --git a/Sources/FoundationNetworking/CMakeLists.txt b/Sources/FoundationNetworking/CMakeLists.txt index 2dec76980a..1a8f516e98 100644 --- a/Sources/FoundationNetworking/CMakeLists.txt +++ b/Sources/FoundationNetworking/CMakeLists.txt @@ -59,6 +59,7 @@ target_compile_options(FoundationNetworking PUBLIC # forced load symbol when validating the TBD -Xfrontend -validate-tbd-against-ir=none $<$:-enable-testing> + "SHELL:-Xfrontend -disable-autolink-framework -Xfrontend CFURLSessionInterface" "SHELL:-Xcc -F${CMAKE_BINARY_DIR}") target_link_libraries(FoundationNetworking PRIVATE diff --git a/Sources/FoundationXML/CMakeLists.txt b/Sources/FoundationXML/CMakeLists.txt index 913c8f42b3..944ea25875 100644 --- a/Sources/FoundationXML/CMakeLists.txt +++ b/Sources/FoundationXML/CMakeLists.txt @@ -10,6 +10,7 @@ target_compile_definitions(FoundationXML PRIVATE DEPLOYMENT_RUNTIME_SWIFT) target_compile_options(FoundationXML PUBLIC $<$:-enable-testing> + "SHELL:-Xfrontend -disable-autolink-framework -Xfrontend CFXMLInterface" "SHELL:-Xcc -F${CMAKE_BINARY_DIR}") target_link_libraries(FoundationXML PRIVATE