Skip to content

Commit 802a2e0

Browse files
committed
cmake: fix a libswift bootstrapping problem with -enable-array-cow-checks
The checks must not be enabled in the first 2 bootstrapping stages.
1 parent 8651e6a commit 802a2e0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ endif()
288288
if(SWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING)
289289
list(APPEND swift_stdlib_compile_flags "-enforce-exclusivity=checked")
290290
endif()
291+
set(compile_flags_for_final_build)
291292
if(SWIFT_ENABLE_ARRAY_COW_CHECKS)
292-
list(APPEND swift_stdlib_compile_flags "-DCOW_CHECKS_ENABLED")
293+
list(APPEND compile_flags_for_final_build "-DCOW_CHECKS_ENABLED")
293294
endif()
294295

295296
# STAGING: Temporarily avoids having to write #fileID in Swift.swiftinterface.
@@ -318,16 +319,16 @@ set(swiftCore_common_options
318319
${SWIFTLIB_SOURCES}
319320
GYB_SOURCES
320321
${SWIFTLIB_GYB_SOURCES}
321-
SWIFT_COMPILE_FLAGS
322-
${swift_stdlib_compile_flags} -Xcc -DswiftCore_EXPORTS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
323322
LINK_FLAGS
324323
${swift_core_link_flags}
325324
PRIVATE_LINK_LIBRARIES
326325
${swift_core_private_link_libraries}
327326
INCORPORATE_OBJECT_LIBRARIES
328327
${swift_core_incorporate_object_libraries}
329328
FRAMEWORK_DEPENDS
330-
${swift_core_framework_depends})
329+
${swift_core_framework_depends}
330+
SWIFT_COMPILE_FLAGS
331+
${swift_stdlib_compile_flags} -Xcc -DswiftCore_EXPORTS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS})
331332

332333
# The copy_shim_headers target dependency is required to let the
333334
# build system know that there's a rule to produce the shims
@@ -375,6 +376,7 @@ endif()
375376
add_swift_target_library(swiftCore
376377
${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
377378
${swiftCore_common_options}
379+
${compile_flags_for_final_build}
378380
FILE_DEPENDS
379381
${swiftCore_common_dependencies}
380382
INSTALL_IN_COMPONENT

0 commit comments

Comments
 (0)