George
1
I have a Package.swift which leverages C++ interop with the following target:
.target(
name: "MyTarget",
dependencies: ["CxxDependency"],
swiftSettings: [
.interoperabilityMode(.Cxx)
]),
...and a single test target:
.testTarget(
name: "MyTargetTests",
dependencies: ["MyTarget"],
swiftSettings: [
.interoperabilityMode(.Cxx)
]),
However when I run swift test I get the following error:
error: module 'MyTargetTests' was built with C++ interoperability enabled, but current compilation does not enable C++ interoperability
@testable import MyTargetTests
^
Running swift test -Xswiftc -cxx-interoperability-mode=default fixes the issue, so this isn't a huge deal. Just curious: is there a way to get this "special" project being compiled to run the tests to infer the compatibility mode?
Alex_L
(Alex Lorenz)
2
Hey, this is a known issue: Auto Generated *PackageDiscoveredTest Is Incompatible With C++ Interop · Issue #6990 · apple/swift-package-manager · GitHub . Unfortunately your workaround is the only solution I know of so far, so I don't think we have other fixes for the "special" project yet.
2 Likes
George
3
That's what I figured, thanks for the confirmation!