File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -419,6 +419,17 @@ set(SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY
419419 ${SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY_default}
420420 CACHE STRING "MSVC Runtime Library for the standard library" )
421421
422+ if ("${CMAKE_SYSTEM_NAME} " STREQUAL "Windows" AND BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS" AND
423+ CMAKE_BUILD_TYPE STREQUAL "Debug" )
424+ # Building with the host Swift toolchain requires linking just-built binaries
425+ # against the host Swift runtime. In debug builds, that means linking a debug
426+ # binary against a release binary. The MSVC linker does not normally permit
427+ # this, since debug builds enable bounds-checked C++ iterators by default,
428+ # which are not ABI-compatible with regular iterators. Let's instruct MSVC to
429+ # disable bounds-checked iterators to make it possible to do a debug build of
430+ # the Swift compiler with a host toolchain.
431+ add_definitions (-D_ITERATOR_DEBUG_LEVEL=0)
432+ endif ()
422433
423434if (BRIDGING_MODE STREQUAL "DEFAULT" OR NOT BRIDGING_MODE)
424435 if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR "${SWIFT_HOST_VARIANT_SDK} " STREQUAL "WINDOWS" OR (CMAKE_Swift_COMPILER AND CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.8))
You can’t perform that action at this time.
0 commit comments