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

**URL:** https://discourse.cmake.org/t/xcode-c-and-objective-c-interoperability-build-setting-not-getting-set/9337
**Category:** Code
**Tags:** gen:xcode, lang:swift
**Created:** [November 2, 2023, 7:38am UTC](https://discourse.cmake.org/t/xcode-c-and-objective-c-interoperability-build-setting-not-getting-set/9337 "2023-11-02T07:38:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Vipul\_Gupta](https://discourse.cmake.org/user_avatar/discourse.cmake.org/vipul_gupta/32/3948_2.png) [@Vipul\_Gupta](https://discourse.cmake.org/u/Vipul_Gupta)
#### Post date: [November 2, 2023, 7:38am UTC](https://discourse.cmake.org/t/xcode-c-and-objective-c-interoperability-build-setting-not-getting-set/9337/1 "2023-11-02T07:38:25Z")

</div>

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 IDE, the build setting for ‘C++ and Objective-C Interoperability’ is still set to ‘C/Objective C’ like in image below. I should have been set to ‘C++/Objective-C++’.  
 ![2688bf865c5d5b850bfc22540ec626bd22dfef77](https://discourse.cmake.org/uploads/default/original/2X/2/2688bf865c5d5b850bfc22540ec626bd22dfef77.png)

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\>”  
> )  
> .  
> .  
> Any help on how this can be achieved?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 2, 2023, 9:21pm UTC](https://discourse.cmake.org/t/xcode-c-and-objective-c-interoperability-build-setting-not-getting-set/9337/2 "2023-11-02T21:21:02Z")

</div>

Seems like something we need to do a FlagTable-like lookup for? @brad.king?

---

<div class="post-metadata">

### Author: ![brad.king](https://discourse.cmake.org/user_avatar/discourse.cmake.org/brad.king/32/11_2.png) [@brad.king](https://discourse.cmake.org/u/brad.king)
#### Post date: [November 3, 2023, 1:55pm UTC](https://discourse.cmake.org/t/xcode-c-and-objective-c-interoperability-build-setting-not-getting-set/9337/3 "2023-11-03T13:55:45Z")

</div>

The VS generators have flag tables that map flags to the `.vcxproj` properties that MSBuild maps back to the flags. The Xcode generator doesn’t have any such tables currently, and only has hand-coded mapping of a few flags such as debug settings.

---

<div class="post-metadata">

### Author: ![mbel0](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mbel0/32/2797_2.png) [@mbel0](https://discourse.cmake.org/u/mbel0)
#### Post date: [November 8, 2023, 4:45pm UTC](https://discourse.cmake.org/t/xcode-c-and-objective-c-interoperability-build-setting-not-getting-set/9337/4 "2023-11-08T16:45:50Z")

</div>

I guess that the right solution would be  
set(CMAKE\_XCODE\_ATTRIBUTE\_SWIFT\_OBJC\_INTEROP\_MODE objcxx CACHE INTERNAL “”)  
flag list can be found at [https://developer.apple.com/documentation/xcode/build-settings-reference](https://developer.apple.com/documentation/xcode/build-settings-reference)  
unfortunately there are no reference on allowed values (most of them are ON/OFF, but not this one) and can be found only by inspecting .pbxproj files
