Cmake – cross compiling C++ project for iOS

Published

There is no quite a good tutorial for Cmake integration for iOS projects. There are very few found on internet, but lags information. I have a C++ project and I want to cross compile it for my iOS project. I am really not an expert in C++ and Cmake topics. Though, I followed a blog which I was what exactly looking for.

As mentioned in the blog, I used toolchain to execute the Cmake command

mkdir build/ && cd build/ && cmake -G "Xcode" -DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake ../../xxx-cpp -DPLATFORM=OS64COMBINED

And it generated the .xcodeproj in the build directory.

As instructed, I included the generated Xcode solution to my main iOS project and added the C++ project to "Frameworks, Libraries, and Embedded Content" and "Dependencies". Actually I wanted to build the library for iOS devices, so, as mentioned in the comment in the same blog, "The Xcode project generated from Cmake does not require any signing itself. Instead you include that generated Xcode project in another Xcode project that DOES have signing configured", my iOS project was already code signed. When I tried to build the project, I got build error saying "Signing for "xxx" requires a development team. Select a development team in the Signing & Capabilities editor."

Here are my observations

Build main iOS project for devices: BUILD FAILED

Signing for "xxx" requires a development team. Select a development team in the Signing & Capabilities editor.

Build main iOS project for simulator: BUILD FAILED

clang: error: no such file or directory: ‘/Users/user/Workspace/Cmake/Cmake Sample/build/lib/{C++ project}/core/Debug-iphonesimulator/libxxx.dylib’
Command Ld failed with a nonzero exit code

Build generated Xcode project for devices: BUILD FAILED

Choosing ALL_BUILD target

For .app targets: Bundle identifier is missing. xxx doesn’t have a bundle identifier. Add a value for PRODUCT_BUNDLE_IDENTIFIER in the build settings editor.

For .dylib targets: Signing for "xxx" requires a development team. Select a development team in the Signing & Capabilities editor.

Build generated Xcode project for simulator: BUILD SUCCEEDED

Choosing ALL_BUILD target

I have no idea where to find the solution and I have already invested more time in analysing and doing many trial and errors. I really need some advise in cross compiling the Cpp libraries for iOS devices. Thanks in advance!!

Another gentleman is facing a same issue

Source: Ios Questions

Published
Categorised as c++, cmake, cross-compiling, ios, xcode Tagged , , , ,

Answers

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq