Skip to content

Commit 996e65e

Browse files
committed
Set Swift language version to 5
The stdlib needs to build in Swift-5 mode, and ensure that `-swift-verion 5` be included in the commandline explicitly. While the compiler defaults to 5 mode, if it's not included explicitly, it won't be included in the swift interface, which then means that modules that import it will influence how the textual interface is processed. The interface for the stdlib must be processed in the Swift 5 language mode due to sendability. Set it explicitly to ensure that importing modules do not change the Swift language mode. Fixes: rdar://145118843
1 parent 4dae976 commit 996e65e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Runtimes/Core/cmake/modules/CompilerSettings.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
include(CheckSourceCompiles)
22
include(CheckCompilerFlag)
33

4-
# Use C+17
4+
# Use Swift 5 mode
5+
set(CMAKE_Swift_LANGUAGE_VERSION 5)
6+
7+
# Use C++17
58
set(SwiftCore_MIN_CXX_STANDARD 17)
69
# Unset CMAKE_CXX_STANDARD if it's too low and in the CMakeCache.txt
710
if($CACHE{CMAKE_CXX_STANDARD} AND $CACHE{CMAKE_CXX_STANDARD} LESS ${SwiftCore_MIN_CXX_STANDARD})
@@ -19,6 +22,7 @@ set(CMAKE_CXX_STANDARD ${SwiftCore_MIN_CXX_STANDARD} CACHE STRING "C++ standard
1922
set(CMAKE_CXX_STANDARD_REQUIRED YES)
2023
set(CMAKE_CXX_EXTENSIONS NO)
2124

25+
2226
check_source_compiles(CXX
2327
"#if !(__has_attribute(swiftcall) && \
2428
__has_attribute(swift_context) && \

0 commit comments

Comments
 (0)