-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
When building a SwiftPM package that includes a test target which triggers automatic this function https://github.com/apple/swift-package-manager/blob/9854e40a1fe2319b11ce91ce6eddea7b5bb179fd/Sources/Build/BuildPlan/BuildPlan%2BTest.swift#L68C18-L68C42 you can end up in a situation where the generated target is not compiled with C++ interop enabled, which then leads to the following compilation error:
[3/13] Emitting module ArcPackageDiscoveredTests
<unknown>:0: error: module 'Cxx' was built with C++ interoperability enabled, but current compilation does not enable C++ interoperability
<unknown>:0: note: visit https://www.swift.org/documentation/cxx-interop/project-build-setup to learn how to enable C++ interoperability
C:\Users\brian\AppData\Local\Programs\Swift\Platforms\0.0.0\Windows.platform\Developer\SDKs\Windows.sdk\usr\share\vcruntime.modulemap:120:8: error: module 'std' requires feature 'cplusplus'
module std [system] {
While I have discovered this issue on Windows, reading the SPM code I'm not sure it's Windows specific.
Expected behavior
I would expected any autogenerated code to respect / understand the interoperability mode specified within the Package.swift file.
Actual behavior
It seems that the interoperability flag is not respected and whatever the *PackageDiscoveredTests target is is built without interoperability concerns and no way to override the default.
Steps to reproduce
Test repo here https://github.com/brianmichel/spm-cxx-interop-autogenerated-entrypoint
Swift Package Manager version/commit hash
No response
Swift & OS version (output of swift --version ; uname -a)
compnerd.org Swift version 5.11-dev (LLVM 1cf95e7e61a3714, Swift bf45c55530acd2a)
Windows 11