XCode project with CMake. How?

Hello all!

My project is C++ with CMake. The application going to be using Network Extension.

Infollowing of official documentation there need to be created subtarget in the project within NE. Is there any manuals of how to add correctly subtarget Network Extension from CMake that will be built with main appication?

Replies

Network Extensions can be packaged in two ways, app extension or system extension, depending on the extension type and target platform. See TN3134 Network Extension provider deployment for the specifics. Which one are you aiming for?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

My way is Appex, not Sysex. Need to create CMake project that included app extension.

There’s two parts to this:

  1. Getting CMake to create an appex

  2. Configuring that appex to be an NE provider

I don’t maintain expertise in CMake so I can’t help you with the first. I recommend that you ask this via the support channel for that third-party tool.

Once you know how to create any type of appex, the NE specifics are:

  1. Subclass the relevant NE provider class. For example, if you’re building a packet tunnel provider, subclass NEPacketTunnelProvider.

  2. Populate the NSExtension value within the Info.plist like so:

    <key>NSExtension</key>
    <dict>
        <key>NSExtensionPointIdentifier</key>
        <string>PPP</string>
        <key>NSExtensionPrincipalClass</key>
        <string>CCC</string>
    </dict>
    

    where:

    • PPP is the extension point. For example, a packet tunnel provider would have com.apple.networkextension.packet-tunnel.

    • CCC is the name of your class from step 1. If that class is written in Swift, make sure to prefix it with the module name.

  3. Add an embedded provisioning profile with the Network Extension capability.

  4. Sign your appex with the Network Extension entitlement (com.apple.developer.networking.networkextension). Again, the specific value varies by provider type. As an example, in a packet tunnel provider the value is an array containing packet-tunnel-provider.

  5. Repeat steps 3 and 4 for the container app.

If you get stuck, a good technique is to create a test project using Xcode and then crib values from there.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Got created CMake project template with NetworkExtension with C++/Qt. The template published here For now fighting with this error in Info.plist and Entitlements but CMake project strucutre is working. And project could be built with Xcode and Qt Creator.