Skip to content

Commit 6a7a4c8

Browse files
authored
Merge pull request #72033 from tshortli/swift-compiler-sources-cxx-interop-flag
CMake: Specify modern Cxx interop flag when building SwiftCompilerSources
2 parents 88d4680 + 066b6d1 commit 6a7a4c8

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)