# Create WatchKit extension XCode project structure

**URL:** https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864
**Category:** Usage
**Tags:** os:ios
**Created:** [April 9, 2023, 4:15am UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864 "2023-04-09T04:15:05Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![tqu-dev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tqu-dev/32/3328_2.png) [@tqu-dev](https://discourse.cmake.org/u/tqu-dev)
#### Post date: [April 9, 2023, 4:15am UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/1 "2023-04-09T04:15:05Z")

</div>

Hi,

At the moment I am using cmake for generating a xCode iOS project (using Qt for iOS framework) which is then used for creating an archive and for the app store submission. Now I want to add a WatchKit extension to the iOS app. This can be manually done in Xcode but each time cmake is run again, the xCode project is re-written and the WatchKit project structure must be manually re-created in xCode (which is a lot of work).

It is possible to compile for WatchOS ([https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos)) but this does not create the appropriate xCode project structure.

Is it possible to generate a WatchOS/WatchKit extension structure ([https://developer.apple.com/documentation/watchkit/setting\_up\_a\_watchos\_project?language=objc#3295999](https://developer.apple.com/documentation/watchkit/setting_up_a_watchos_project?language=objc#3295999)) using cmake?

Thanks,

---

<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: [April 24, 2023, 4:48am UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/2 "2023-04-24T04:48:07Z")

</div>

There are `XCODE_ATTRIBUTE_*` properties that are available. But maybe this needs some dedicated support.

---

<div class="post-metadata">

### Author: ![tqu-dev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tqu-dev/32/3328_2.png) [@tqu-dev](https://discourse.cmake.org/u/tqu-dev)
#### Post date: [April 24, 2023, 12:58pm UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/3 "2023-04-24T12:58:18Z")

</div>

Yes, but to the best of my knowledge none of these work for this use case.

---

<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: [April 24, 2023, 1:32pm UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/4 "2023-04-24T13:32:48Z")

</div>

Knowing what to put into the Xcode project files would be a great help here. We’ve always had to reverse engineer the format.

---

<div class="post-metadata">

### Author: ![tqu-dev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tqu-dev/32/3328_2.png) [@tqu-dev](https://discourse.cmake.org/u/tqu-dev)
#### Post date: [April 24, 2023, 1:37pm UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/5 "2023-04-24T13:37:14Z")

</div>

Is it sufficient to post a project before and after adding the WatchKit extension (so that you can diff it)? Or do you need something else?

---

<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: [April 24, 2023, 5:08pm UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/6 "2023-04-24T17:08:15Z")

</div>

I suspect instructions for what boxes to poke in Xcode would also be helpful, but a before-and-after can’t hurt.

---

<div class="post-metadata">

### Author: ![tqu-dev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tqu-dev/32/3328_2.png) [@tqu-dev](https://discourse.cmake.org/u/tqu-dev)
#### Post date: [April 25, 2023, 3:46am UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/7 "2023-04-25T03:46:14Z")

</div>

Attached is a sample project ([https://bit.ly/41UY13r](https://bit.ly/41UY13r)):

- sampleqt: The Qt project with the CMakeLists.txt
- build-sampleqt-Qt\_6\_5\_0\_for\_iOS\_BEFORE\_WATCHKIT: The generated xCode project before adding WatchKit support.
- build-sampleqt-Qt\_6\_5\_0\_for\_iOS\_AFTER\_WATCHKIT: The generated xCode project after manually adding WatchKit support.

---

<div class="post-metadata">

### Author: ![tqu-dev](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tqu-dev/32/3328_2.png) [@tqu-dev](https://discourse.cmake.org/u/tqu-dev)
#### Post date: [April 25, 2023, 3:46am UTC](https://discourse.cmake.org/t/create-watchkit-extension-xcode-project-structure/7864/8 "2023-04-25T03:46:29Z")

</div>

This video shows how to manually add WatchKit support to a xCode project:

[![](https://discourse.cmake.org/uploads/default/original/2X/4/4b5b99976adb331267a75fde256f53c116de4bb9.jpeg "Add WatchKit to Qt iOS App") ](https://www.youtube.com/watch?v=KaDa1-dQ06g)
