Setup Cpp-Swift Interoperability using CMake

161 Views Asked by At

I have been using the Cpp-Swift Interoperability in Xcode15 for direct communication between Cpp and Swift code. It required a few Build settings changes for the Swift Compiler, creating clang modules(module map file) to access cpp code in swift, specifying module map path to the swift compiler etc.

I wanted to use this interoperability feature in my visual studio project which is using Cmake. I want to build via cmake, using Xcode generator.

Prior to Swift5.9, we were using a ObjC bridging header whose support was provided in the Cmake using the Xcode attribute flag 'XCODE_ATTRIBUTE_SWIFT_OBJC_BRIDGING_HEADER'. Similarly we were specifying the generated header using the attribute 'XCODE_ATTRIBUTE_SWIFT_OBJC_INTERFACE_HEADER_NAME'

I m not able to find similar Xcode attribute property flags for my Cmake to enable this interoperability. What are the changes that we need to make in the Cmake(using Xcode generator) for this new interoperability to work. Can someone help with this?

0

There are 0 best solutions below