This should be the minimal required toolchain with a reasonably recent Xcode. Note that this doesn't set any search paths for the various find_...() commands, if that matters to you, but it should get you past the try_compile() stage in the first project() command (which I think is where you're getting your error message from). It will also allow you to switch between device and simulator builds at build time (Xcode handles that for you, even though you only specified iphoneos as the sysroot). You can also choose the architecture at build time too.
What you need to do after that in terms of setting up code signing depends on what Xcode version you're using and whether you want to use automatic signing and provisioning or whether you want full manual control. For more info than you probably care about for this last point, a detailed write-up can be found here (not specific to CMake though):
If you're happy using Xcode 8 or later and automatic signing/provisioning, you only need to set two things (three if you want to specify the deployment target, which you probably do). Put something like this after the first project() command:
Replace xxxxxxxxxx with your development team ID. Even for distribution builds, you want the code signing identity set to "iPhone Developer" - see the above code signing link for the reasons why. Chances are your project wants a specific deployment target, but developers may have a need to override the development team ID and/or the signing identity in certain circumstances, hence why these two have been defined as cache variables in the above example but the deployment target hasn't.
See if that enables you to make some progress.
On Tue, Oct 17, 2017 at 8:12 PM, Robert Bielik <[hidden email]> wrote:
CMake version: 3.9.4
Trying to build protobuf on iOS via the toolchains @ https://github.com/ruslo/polly (ios-10-2.cmake). With some additional tricks in my wrapper CMakeLists file:
it works fine up til the point where protoc is compiled. CMake files are generated like so:
cmake -GXcode -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/polly/ios-10-2.cmake <path to my protobuf wrapper>
The error produced is:
target specifies product type 'com.apple.product-type.tool', but there's no such product type for the 'iphoneos' platform
Granted, I won't really need the protoc target during cross building, but I'd rather stay clear of the CMake files of protobuf.