Skip to content

Commit 351222f

Browse files
authored
[cxx-interop] Do not pass the C++ standard if C++ interop is not enabled (#7188)
This fixes the Swift PR testing failures. ### Motivation: If C++ interop is not enabled, SwiftPM should not pass `-Xcc -std=c++17` flags. ### Result: Only pass these flags if C++ interop is enabled.
1 parent c53c72f commit 351222f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,14 @@ public final class SwiftTargetBuildDescription {
565565
let dependencySwiftFlags = dependencyScope.evaluate(.OTHER_SWIFT_FLAGS)
566566
if let interopModeFlag = dependencySwiftFlags.first(where: { $0.hasPrefix("-cxx-interoperability-mode=") }) {
567567
args += [interopModeFlag]
568+
if interopModeFlag != "-cxx-interoperability-mode=off" {
569+
if let cxxStandard = self.package.manifest.cxxLanguageStandard {
570+
args += ["-Xcc", "-std=\(cxxStandard)"]
571+
}
572+
}
568573
break
569574
}
570575
}
571-
if let cxxStandard = self.package.manifest.cxxLanguageStandard {
572-
args += ["-Xcc", "-std=\(cxxStandard)"]
573-
}
574576
default: break
575577
}
576578

0 commit comments

Comments
 (0)