Skip to content

Commit 9fb5250

Browse files
committed
stdlib: prevent static builds on Darwin
Static builds of the standard library and the SDK overlay are unsupported post ABI stability. Disallow building of the standard library and SDK overlay statically for Darwin platforms.
1 parent 65ed4cb commit 9fb5250

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

stdlib/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ if(SWIFT_BUILD_DYNAMIC_STDLIB)
7777
list(APPEND SWIFT_STDLIB_LIBRARY_BUILD_TYPES SHARED)
7878
endif()
7979
if(SWIFT_BUILD_STATIC_STDLIB)
80-
list(APPEND SWIFT_STDLIB_LIBRARY_BUILD_TYPES STATIC)
80+
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}" building_darwin_sdks)
81+
if(building_darwin_sdks)
82+
message(SEND_ERROR "cannot build static standard library for Darwin SDKs")
83+
else()
84+
list(APPEND SWIFT_STDLIB_LIBRARY_BUILD_TYPES STATIC)
85+
endif()
8186
endif()
8287

8388
function(swift_create_stdlib_targets name variant define_all_alias)

stdlib/public/Darwin/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ if(SWIFT_BUILD_DYNAMIC_SDK_OVERLAY)
55
list(APPEND SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES SHARED)
66
endif()
77
if(SWIFT_BUILD_STATIC_SDK_OVERLAY)
8-
list(APPEND SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES STATIC)
8+
list_intersect("${SWIFT_APPLE_PLATFORMS}" "${SWIFT_SDKS}" building_darwin_sdks)
9+
if(building_darwin_sdks)
10+
message(SEND_ERROR "cannot build static standard library for Darwin SDKs")
11+
else()
12+
list(APPEND SWIFT_SDK_OVERLAY_LIBRARY_BUILD_TYPES STATIC)
13+
endif()
914
endif()
1015

1116
set(all_overlays

0 commit comments

Comments
 (0)