Xcode ‘C++ and Objective-C Interoperability’ build setting not getting set

138 views Asked by At

I m trying to create an xcode project with cpp-swift interoperability(introduced in xcode15) using cmake xcode generator. I m able to invoke cpp code in swift and vice-versa but when opening the project in xcode, the build setting for 'C++ and Objective-C Interoperability' is still set to 'C/Objective C' like in image below. I want to set it to 'C++/Objective-C++'. enter image description here

I m using the below cmake for this:

.
.

add_library(cxx-support ./Sources/CxxSupport/Student1.cpp
./Sources/CxxSupport/Teacher.swift
)

#include the directory to access modulemap content
target_include_directories(cxx-support PUBLIC
${CMAKE_SOURCE_DIR}/Sources/CxxSupport)

target_compile_options(cxx-support PUBLIC
"$<$<COMPILE_LANGUAGE:Swift>:-cxx-interoperability-mode=default>"
)
.
.

I Have also tried the below in cmake, but it didn't work.

 #set(SWIFT_OBJC_INTEROP_MODE "objcxx" CACHE STRING "") 
 #target_compile_options(cxx-support PUBLIC "SWIFT_OBJC_INTEROP_MODE=objcxx")

Any help on how this can be achieved?

0

There are 0 answers