Skip to content

Commit 83fe59b

Browse files
committed
CMake: Specify modern Cxx interop flag when build SwiftCompilerSources.
Now that swift-ci builds with a Swift 5.9 or later Swift toolchain, we can specify the `-cxx-interoperability-mode` flag instead of the deprecated `-enable-experimental-cxx-interop` flag.
1 parent 0cc0590 commit 83fe59b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

SwiftCompilerSources/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,17 @@ function(add_swift_compiler_modules_library name)
9898
"DEPENDS"
9999
${ARGN})
100100

101+
# Prior to 5.9, we have to use the experimental flag for C++ interop.
102+
if (CMAKE_Swift_COMPILER_VERSION VERSION_LESS 5.9)
103+
set(cxx_interop_flag "-enable-experimental-cxx-interop")
104+
else()
105+
set(cxx_interop_flag "-cxx-interoperability-mode=default")
106+
endif()
107+
101108
set(swift_compile_options
102109
"-color-diagnostics"
103110
"-Xfrontend" "-validate-tbd-against-ir=none"
104-
"-Xfrontend" "-enable-experimental-cxx-interop"
111+
"${cxx_interop_flag}"
105112
"-Xfrontend" "-disable-target-os-checking"
106113
"-Xcc" "-std=c++17"
107114
"-Xcc" "-DCOMPILED_WITH_SWIFT" "-Xcc" "-DSWIFT_TARGET"

0 commit comments

Comments
 (0)