Workflow for iOS devices (pushing to device, debugging)

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?


I’m not sure if crosscompiling for iOS is supported with non-Xcode toolchains. You can use AppleClang + the Xcode CMake generator and still build only from the command line, though, without needing to actually use Xcode as your IDE.

One can probably get CMake to compile with a proper toolchain file, but all of the device simulator and other convenience things are Xcode behaviors that would need reproduced with add_custom_command.

I can’t use the Xcode generator because it errors out when there C++ modules in the code. I’m using the latest Clang, not Apple’s Clang.

The brew package ideviceinstaller looks like it will be useful for pushing to a device, if I can compile something in the right format.

I did find MACOSX_BUNDLE for an executable, but so far I’ve got it creating an a macOS bundle, not an iOS one.

add_executable(test_app MACOSX_BUNDLE

ideviceinstaller -i ./build-debug/Learning/                     
Uploading package contents... DONE.
ERROR: could not locate ./build-debug/Learning/ in app!

Because it’s put Info.plist it in a nested directory structure like a macOS app.