Skip to content

Commit 9c09020

Browse files
authored
Merge pull request #59020 from apple/egorzhdan/libswift-version-check
[SwiftCompilerSources][build] Require recent Swift compiler in `HOSTTOOLS` mode
2 parents 5fbede2 + 2b3980b commit 9c09020

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ else()
204204
message(FATAL_ERROR "Need a swift toolchain building swift compiler sources")
205205
endif()
206206

207+
if(${BOOTSTRAPPING_MODE} STREQUAL "HOSTTOOLS")
208+
if(NOT SWIFT_EXEC_FOR_SWIFT_MODULES STREQUAL CMAKE_Swift_COMPILER)
209+
message(FATAL_ERROR "The Swift compiler (${CMAKE_Swift_COMPILER}) differs from the Swift compiler in SWIFT_NATIVE_SWIFT_TOOLS_PATH (${SWIFT_NATIVE_SWIFT_TOOLS_PATH}/swiftc).")
210+
endif()
211+
212+
set(min_supported_swift_version 5.5)
213+
if(CMAKE_Swift_COMPILER_VERSION VERSION_LESS "${min_supported_swift_version}")
214+
message(FATAL_ERROR
215+
"Outdated Swift compiler: building with host tools requires Swift ${min_supported_swift_version} or newer. "
216+
"Please update your Swift toolchain or switch BOOTSTRAPPING_MODE to BOOTSTRAPPING(-WITH-HOSTLIBS)? or OFF.")
217+
endif()
218+
endif()
219+
207220
add_swift_compiler_modules_library(swiftCompilerModules
208221
SWIFT_EXEC "${SWIFT_EXEC_FOR_SWIFT_MODULES}")
209222

0 commit comments

Comments
 (0)