Skip to content

Commit f26048d

Browse files
authored
Merge pull request #26210 from compnerd/dynamic-only
stdlib: prevent static builds on Darwin
2 parents de2dc57 + 9fb5250 commit f26048d

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)