Skip to content

[C++ interop] A Swift executable target that depends on a Swift library target that enables C++ interop should tell Swift to link using clang++, even when C++ interop is not enabled in the executable target #6564

@hyp

Description

@hyp

Description

C++ interoperability can be enabled using the new .interoperabilityMode(.Cxx) setting.
We want to support a case where a Swift library target can enable C++ interoperability, but still be imported into another Swift target that doesn't enable C++ interoperability. That works today now that swiftlang/swift#65948 is fixed.
However, when an executable Swift target that depends on such Swift target gets linked, it doesn't use clang++ to link, i.e. it thinks that it can link the program as if C++ interop was not enabled in the entire dependency tree.

Expected behavior

SwiftPM should detect when an executableTarget depends on a Swift target that enables C++ interop and pass a flag to Swift driver that tells it that it should link as if interop is enabled.

Actual behavior

No response

Steps to reproduce

No response

Swift Package Manager version/commit hash

No response

Swift & OS version (output of swift --version ; uname -a)

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions