# Creating an .ipa from .app for iOS using CMake

**URL:** https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942
**Category:** Code
**Created:** [June 27, 2022, 11:02am UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942 "2022-06-27T11:02:08Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Karan\_Dixit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/karan_dixit/32/2541_2.png) [@Karan\_Dixit](https://discourse.cmake.org/u/Karan_Dixit)
#### Post date: [June 27, 2022, 11:02am UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/1 "2022-06-27T11:02:08Z")

</div>

We are building an application that would be cross-platform and hence using CMake as the build system.While building for iOS/iPadOS/tvOS etc, when `add_executable` is done with MACOSX\_BUNDLE, CMake generates a `.app`. Is there a way I can generate a `.ipa` once `.app` is available or directly through CMake?

---

<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: [June 27, 2022, 6:05pm UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/2 "2022-06-27T18:05:25Z")

</div>

Is that something that CPack should be doing or is it something that the compiler(s) tend to write directly?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [June 27, 2022, 10:13pm UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/3 "2022-06-27T22:13:04Z")

</div>

Apple platforms are a bit special. I’d recommend the following if you’re wanting to generate an app for uploading to the app store or using with a private MDM:

- Use the Xcode generator.
- Use `xcodebuild archive` to produce an archive of your app, then `xcodebuild -exportArchive` to prepare it for distribution.

I’m skipping a lot of detail there, but those are the high level steps I’ve used in the past and would recommend. Apple’s code signing and app bundle technologies don’t really fit all that well with the way CPack works.

---

<div class="post-metadata">

### Author: ![Karan\_Dixit](https://discourse.cmake.org/user_avatar/discourse.cmake.org/karan_dixit/32/2541_2.png) [@Karan\_Dixit](https://discourse.cmake.org/u/Karan_Dixit)
#### Post date: [June 28, 2022, 6:59am UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/4 "2022-06-28T06:59:55Z")

</div>

We are setting these XCode attributes for building through cmake:

XCODE\_ATTRIBUTE\_CODE\_SIGNING\_ALLOWED “Yes”  
XCODE\_ATTRIBUTE\_CODE\_SIGN\_STYLE “Automatic”  
XCODE\_ATTRIBUTE\_DEVELOPMENT\_TEAM “XYZ”

After using these I am getting this error:

Command CodeSign failed with a nonzero exit code :

xcodebuild[7441:1813649] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore

xcodebuild[7441:1813649] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore

\*\* BUILD FAILED \*\*

Do you have any idea about this?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [June 30, 2022, 11:24am UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/5 "2022-06-30T11:24:56Z")

</div>

I’m not familiar with `XCODE_ATTRIBUTE_CODE_SIGN_STYLE`. I haven’t needed to use that in the past, but I also haven’t had to build signed Apple products for a while now so I don’t know if something changed in the latest Xcode releases. I can’t offer any guidance on this error I’m afraid, but I would be interested if you find the cause and a workaround/fix.

---

<div class="post-metadata">

### Author: ![mlokhandwala](https://discourse.cmake.org/user_avatar/discourse.cmake.org/mlokhandwala/32/2935_2.png) [@mlokhandwala](https://discourse.cmake.org/u/mlokhandwala)
#### Post date: [November 20, 2022, 8:22am UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/6 "2022-11-20T08:22:45Z")

</div>

@Karan_Dixit we are having the same issue and trying to do similar things. We are using QT on IOS (iPad) and so far we were using QMake and XCodeBuild. We are moving to CMake and managed to compile and build but we are now stuck on the next steps of signing and building the IPA using CMake directly. Maybe we can exchange notes? Can you connect with us on mlokhandwala@cybercraft.llc ?

---

<div class="post-metadata">

### Author: ![RobN](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/e9bcb4/32.png) [@RobN](https://discourse.cmake.org/u/RobN)
#### Post date: [March 22, 2023, 2:05pm UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/7 "2023-03-22T14:05:37Z")

</div>

Did you guys ever figure this out? I’m using the latest Clang and C++ modules, so the Xcode generator with CMake doesn’t work.

I need to know how to:

1. Package and run on an iOS device.
2. Package and upload to App Store (iOS and macOS)

I’d like to know how to:

1. Package and run on simulators.
2. Debug with LLDB, with processes on device or simulators.

Maybe I need to burn some Apple “DTS” tickets to see if they can help me.

---

<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: [March 22, 2023, 2:19pm UTC](https://discourse.cmake.org/t/creating-an-ipa-from-app-for-ios-using-cmake/5942/8 "2023-03-22T14:19:05Z")

</div>

This thread is related:

> [@Workflow for iOS devices (pushing to device, debugging)](https://discourse.cmake.org/t/workflow-for-ios-devices-pushing-to-device-debugging/7716):
>
> Does anyone use CMake to build and run an iOS app, without working (much) in Xcode? I’ve been using CMake + Emacs a lot lately, to build executables for desktop or command line. I’d like to start doing the same for iOS apps. When I used to use Xcode, it was pretty simple to compile and run a project on a simulator or device that was connected via USB cable. I’d like to setup a similar workflow with minimal use of Xcode. Is it possible? Rob
