A toolchain file and examples using cmake for iOS development

Overview

ios-cmake

A toolchain file and examples using cmake for iOS development. This is a fork of a similar project found on https://code.google.com/p/ios-cmake/

Tested with Xcode 11.4.1

In order to compile the static library for the iOS simulator (fat file: i386 x86_64), change to the folder where the library sources reside, then:

mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../toolchain/iOS.cmake -DIOS_PLATFORM=SIMULATOR
make
make install

Once the library is compiled and installed, change to the folder where the sample application sources reside, then open Xcode project:

open hello-app.xcodeproj

Set IOS_PLATFORM to OS to build for Device (the generated library is a fat file: armv7 armv7s arm64).

Comments
  • The CMAKE_FORCE_CXX_COMPILER macro is deprecated

    The CMAKE_FORCE_CXX_COMPILER macro is deprecated

    The CMAKE_FORCE_CXX_COMPILER macro is deprecated. Instead just set CMAKE_CXX_COMPILER and allow CMake to identify the compiler. Call Stack (most recent call first): toolchain/iOS.cmake:51 (CMAKE_FORCE_CXX_COMPILER) build.ios/CMakeFiles/3.7.1/CMakeSystem.cmake:6 (include) CMakeLists.txt

    opened by zmjios 3
  • All of header files not found

    All of header files not found

    I'm sure "CMAKE_IOS_DEVELOPER_ROOT" is set correctly,but all header files are not found in logs.

    the build commond like this: cmake -DCMAKE_TOOLCHAIN_FILE=../iOS.cmake -DCMAKE_IOS_DEVELOPER_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/ -GXcode ..

    the logs like this:

    • Toolchain using default iOS SDK: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -- The C compiler identification is AppleClang 9.0.0.9000039 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - failed -- Detecting C compile features -- Detecting C compile features - failed -- Could NOT find Git (missing: GIT_EXECUTABLE) -- Could NOT find Git (missing: GIT_EXECUTABLE) -- Performing Test check_c_compiler_flag__Wno_error_deprecated_declarations -- Performing Test check_c_compiler_flag__Wno_error_deprecated_declarations - Failed -- Performing Test check_c_compiler_flag__Qunused_arguments -- Performing Test check_c_compiler_flag__Qunused_arguments - Failed -- Looking for GNU_LIBRARY -- Looking for GNU_LIBRARY - not found -- Looking for _GNU_SOURCE -- Looking for _GNU_SOURCE - not found -- Looking for sys/types.h -- Looking for sys/types.h - not found -- Looking for sys/socket.h -- Looking for sys/socket.h - not found -- Looking for netinet/in.h -- Looking for netinet/in.h - not found ... ...
    opened by MinorUncle 1
  • Doesn't find Threads

    Doesn't find Threads

    find_package(Threads REQUIRED) fails with:

    -- Looking for pthread.h - not found
    CMake Error at /Applications/CMake.app/Contents/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
     Could NOT find Threads (missing: Threads_FOUND)
    Call Stack (most recent call first):
     /Applications/CMake.app/Contents/share/cmake-3.6/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
     /Applications/CMake.app/Contents/share/cmake-3.6/Modules/FindThreads.cmake:223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
     dlib/CMakeLists.txt:195 (find_package)
    

    If I generate normal Xcode macos project and change type to iOS manually, it works and compiles fine.

    opened by grisevg 1
  •   No iOS SDK's found in default search path

    No iOS SDK's found in default search path

    CMake Error at /Users/allen/Desktop/ios-cmake/toolchain/iOS.cmake:149 (message): No iOS SDK's found in default search path /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk.

    opened by lengqingfeng 1
  • Simulator64 object file is seen as OSX library

    Simulator64 object file is seen as OSX library

    When building with this script for simulator64, the resulting binary is seen in Xcode differently; when linking to it during a simulator build inside Xcode, the following is reported:

    building for iOS simulator, but linking in object file built for OSX, for architecture x86_64

    opened by stoeckley 1
  • Kill the CMake Error -- clang/clang++  is not a full path and was not…

    Kill the CMake Error -- clang/clang++ is not a full path and was not…

    … found in the PATH.

    CMake Error at CMakeLists.txt:3 (project): The CMAKE_CXX_COMPILER:

    clang++

    is not a full path and was not found in the PATH.

    Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

    CMake Error at CMakeLists.txt:3 (project): The CMAKE_C_COMPILER:

    clang

    is not a full path and was not found in the PATH.

    Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

    opened by iCodist 0
  • Fixed CMake warning CMP0054

    Fixed CMake warning CMP0054

    https://cmake.org/cmake/help/v3.1/policy/CMP0054.html CMake 3.1 and above no longer implicitly dereference variables or interpret keywords in an if() command argument when it is a Quoted Argument or a Bracket Argument.

    opened by Antonrr 1
Owner
Bogdan Cristea
PhD Engineer in Telecommunications with more than 15 years of experience in software development.
Bogdan Cristea
cmake-avr - a cmake toolchain for AVR projects

cmake-avr - a cmake toolchain for AVR projects Testing the example provided The toolchain was created and tested within the following environment: Lin

Matthias Kleemann 162 Oct 24, 2022
CMake toolchain file and other scripts for the Android NDK

android-cmake CMake is great, and so is Android. This is a collection of CMake scripts that may be useful to the Android NDK community. It is based on

Andrey Kamaev 1.2k Nov 14, 2022
CMake toolchain for all Arduino compatible boards

Arduino CMake Toolchain Arduino CMake toolchain is a CMake toolchain for cross-compiling CMake based projects for all Arduino compatible boards (AVR,

Arun 109 Nov 22, 2022
Useful CMake Examples

CMake Examples Table of Contents Introduction Requirements Installation on Ubuntu Docker Other Links Introduction CMake is a cross-platform open-sourc

Thom Troy 9.6k Nov 25, 2022
CMake: config mode of find_package command (examples)

Install Foo Install project Foo in Debug and Release variants (Makefile generator): > cmake -HFoo -B_builds/Foo-debug -DCMAKE_BUILD_TYPE=Debug -DCMAKE

null 366 Nov 17, 2022
CMake scripts for painless usage of SuiteSparse+METIS from Visual Studio and the rest of Windows/Linux/OSX IDEs supported by CMake

CMake scripts for painless usage of Tim Davis' SuiteSparse (CHOLMOD,UMFPACK,AMD,LDL,SPQR,...) and METIS from Visual Studio and the rest of Windows/Lin

Jose Luis Blanco-Claraco 394 Nov 24, 2022
CMake module to enable code coverage easily and generate coverage reports with CMake targets.

CMake-codecov CMake module to enable code coverage easily and generate coverage reports with CMake targets. Include into your project To use Findcodec

HPC 82 Oct 25, 2022
unmaintained - CMake module to activate certain C++ standard, feature checks and appropriate automated workarounds - basically an improved version of cmake-compile-features

Compatibility This library provides an advanced target_compile_features() and write_compiler_detection_header(). The problem with those is that they a

Jonathan Müller 72 Apr 14, 2022
📦 CMake's missing package manager. A small CMake script for setup-free, cross-platform, reproducible dependency management.

Setup-free CMake dependency management CPM.cmake is a CMake script that adds dependency management capabilities to CMake. It's built as a thin wrapper

CPM.cmake 1.5k Nov 25, 2022
CMake checks cache helper modules – for fast CI CMake builds!

cmake-checks-cache Cross platform CMake projects do platform introspection by the means of "Check" macros. Have a look at CMake's How To Write Platfor

Cristian Adam 64 Nov 18, 2022
cmake-font-lock - Advanced, type aware, highlight support for CMake

cmake-font-lock - Advanced, type aware, highlight support for CMake

Anders Lindgren 39 Oct 2, 2022
Make CMake less painful when trying to write Modern Flexible CMake

Izzy's eXtension Modules IXM is a CMake library for writing Modern flexible CMake. This means: Reducing the amount of CMake written Selecting reasonab

IXM 107 Sep 1, 2022
[CMake] [BSD-2] CMake module to find ICU

FindICU.cmake A CMake module to find International Components for Unicode (ICU) Library Note that CMake, since its version 3.7.0, includes a FindICU m

julp 29 Nov 2, 2022
Examples of using Hunter package manager to build and run Android application.

Examples of using Hunter package manager to build and run Android application. Requirements Android NDK Go to download page and choose NDK for your pl

null 33 Oct 11, 2022
CMake macro to determine the language of a header file

CMake Determine Header Language CMake macro to determine the language of a header file. Status Travis CI (Ubuntu) AppVeyor (Windows) Coverage Biicode

ポリ平方 POLYSQUARE 4 Dec 7, 2018
A template C++ repository, using CMake and Catch

C++ Project Template This is a template project for C++. It uses CMake to build and Catch for unit tests. It is integrated with Travis CI, and builds

Joshua Peterson 49 Oct 23, 2022
Example library that shows best practices and proper usage of CMake by using targets

Modern CMake Sample Sample project that shows proper modern CMake usage on a dummy library and an executable that uses it. Accompanying code to my blo

Pablo Arias 588 Nov 28, 2022
CMake module for building IDL files with MIDL and generating CLR DLL using Tlbimp

FindIDL CMake module for building IDL files with MIDL and generating CLR DLL using Tlbimp. Introduction Requirements Usage find_package() add_idl() ad

Apriorit Inc. 17 Nov 6, 2022
NeoWorld is a resampler using the CMake build system

NeoWorld is a resampler using the CMake build system. It's designed for utsu, OpenUTAU, and UTAU.

null 4 Jun 24, 2022