Creating an .ipa from .app for iOS using CMake

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?

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

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.

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?

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.

@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 ?

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.

This thread is related: