From 775b3bb87c417d8ee52e4d6d07fa3cab58d64209 Mon Sep 17 00:00:00 2001 From: Finagolfin Date: Mon, 11 Aug 2025 04:42:45 +0530 Subject: [PATCH] [CMake] Don't export module map for Windows if a prebuilt SDK is available, as unneeded after swiftlang/swift#79621 --- CMakeLists.txt | 1 + Sources/_FoundationCShims/CMakeLists.txt | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31638c287..efcb4fe9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ set(COLLECTIONS_SINGLE_MODULE YES) set(COLLECTIONS_FOUNDATION_TOOLCHAIN_MODULE YES) set(SwiftFoundation_MACRO "" CACHE STRING "Path to Foundation macro plugin") +set(USE_PREBUILT_SDK NO CACHE BOOL "A full prebuilt SDK is available, so use its headers") # Make sure our dependencies exists include(FetchContent) diff --git a/Sources/_FoundationCShims/CMakeLists.txt b/Sources/_FoundationCShims/CMakeLists.txt index 1798a5bb0..341056f1b 100644 --- a/Sources/_FoundationCShims/CMakeLists.txt +++ b/Sources/_FoundationCShims/CMakeLists.txt @@ -17,10 +17,13 @@ add_library(_FoundationCShims STATIC string_shims.c uuid.c) -target_include_directories(_FoundationCShims PUBLIC include) -target_compile_options(_FoundationCShims INTERFACE - "$<$:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR}/include/module.modulemap>") +if(NOT USE_PREBUILT_SDK) + target_include_directories(_FoundationCShims PUBLIC include) + + target_compile_options(_FoundationCShims INTERFACE + "$<$:SHELL:-Xcc -fmodule-map-file=${CMAKE_CURRENT_SOURCE_DIR}/include/module.modulemap>") +endif() set_property(GLOBAL APPEND PROPERTY SWIFT_FOUNDATION_EXPORTS _FoundationCShims)