leetal
ios-cmake
CMake

A CMake toolchain file for iOS/iPadOS, visionOS, macOS, watchOS & tvOS C/C++/Obj-C++ development

Last updated Jul 3, 2026
2.2k
Stars
465
Forks
17
Issues
0
Stars/day
Attention Score
81
Language breakdown
CMake 92.3%
Objective-C 5.9%
C++ 1.5%
Objective-C++ 0.3%
โ–ธ Files click to expand
README

A CMake toolchain file for iOS (+ Catalyst), watchOS, tvOS and macOS development with full simulator support and toggleable options!

ios-cmake

catalyst-jobs   combined-jobs   ios-jobs

macos-jobs   tvos-jobs   watchos-jobs

visionos-jobs

Platform flag options (-DPLATFORM=flag)

  • OS - to build for iOS (armv7, armv7s, arm64) -- DEPRECATED in favour of OS64
  • OS64 - to build for iOS (arm64 only)
  • OS64COMBINED - to build for iOS & iOS Simulator (FAT lib) (arm64, x86_64)
  • SIMULATOR - to build for iOS simulator 32 bit (i386) -- DEPRECATED
  • SIMULATOR64 - to build for iOS simulator 64 bit (x86_64)
  • SIMULATORARM64 - to build for iOS simulator 64 bit (arm64)
  • SIMULATOR64COMBINED - to build for iOS simulator 64 bit (FAT lib) (arm64, x86_64)
  • VISIONOS - to build for visionOS (arm64) -- Apple Silicon Required
  • VISIONOSCOMBINED - to build for visionOS & visionOS Simulator (FAT lib) (arm64) -- Apple Silicon Required
  • SIMULATORVISIONOS_ - to build for visionOS Simulator (arm64) -- Apple Silicon Required
  • TVOS - to build for tvOS (arm64)
  • TVOSCOMBINED - to build for tvOS & tvOS Simulator (arm64, x86_64)
  • SIMULATORTVOS - to build for tvOS Simulator (x8664)
  • SIMULATORARM64TVOS_ = to build for tvOS Simulator (arm64)
  • WATCHOS - to build for watchOS (armv7k, arm64_32)
  • WATCHOSCOMBINED - to build for watchOS & Simulator (armv7k, arm6432, x8664)
  • SIMULATORWATCHOS - to build for watchOS Simulator (x8664)
  • SIMULATORARM64WATCHOS_ = to build for watchOS Simulator (arm64)
  • SIMULATORWATCHOSCOMBINED = to build for watchOS Simulator (FAT lib) (arm64, x8664)
  • MAC - to build for macOS (x86_64)
  • MACARM64_ - to build for macOS on Apple Silicon (arm64)
  • MACUNIVERSAL - to build for macOS on x8664 and Apple Silicon (arm64) combined
  • MACCATALYST - to build iOS for Mac (Catalyst, x8664)
  • MACCATALYSTARM64 - to build iOS for Mac on Apple Silicon (Catalyst, arm64)
  • MACCATALYSTUNIVERSAL - to build iOS for Mac on x8664 and Mac on arm64 combined (Catalyst, x8664, arm64)

Example usage

NOTE: Change the -DPLATFORM to an applicable value if targeting another platform.

cd example/example-lib
cmake -B build -G Xcode -DCMAKETOOLCHAINFILE=../../ios.toolchain.cmake -DPLATFORM=OS64
cmake --build build --config Release

This will build the library for the given PLATFORM. In this case, iOS with the arm64 architecture.

COMBINED Options

The options called *COMBINED (OS64COMBINED, TVOSCOMBINED and WATCHOSCOMBINED) will build complete FAT-libraries for the given platform. These FAT-libraries include slices for both device and simulator, making the distribution and usage of the library much more simple!

Example:

cmake . -G Xcode -DCMAKETOOLCHAINFILE=../../ios.toolchain.cmake -DPLATFORM=OS64COMBINED
cmake --build . --config Release
cmake --install . --config Release # Necessary to build combined library

NOTE: The COMBINED options ONLY work with the Xcode generator (-G Xcode) on CMake versions 3.14+!


Exposed Variables

XCODE_VERSION - Version number (not including Build version) of Xcode detected.

SDK_VERSION - Version of SDK being used.

CMAKEOSXARCHITECTURES - Architectures being compiled for (generated from PLATFORM).

APPLETARGETTRIPLE - Used by autoconf build systems.

Additional Options

-DENABLE_BITCODE=(BOOL) - Disabled by default, specify TRUE or 1 to enable bitcode

-DENABLE_ARC=(BOOL) - Enabled by default, specify FALSE or 0 to disable ARC

-DENABLE_VISIBILITY=(BOOL) - Disabled by default, specify TRUE or 1 to enable symbol visibility support

-DENABLESTRICTTRY_COMPILE=(BOOL) - Disabled by default, specify TRUE or 1 to enable strict compiler checks (will run linker on all compiler checks whenever needed)

-DARCHS=(STRING) - Valid values are: armv7, armv7s, arm64, i386, x8664, armv7k, arm6432. By default it will build for all valid architectures based on -DPLATFORM (see above)

__To combine all platforms into the same FAT-library, either build any of the "COMBINED*" platform types OR use the LIPO tool. More information on how to combine libraries with LIPO is readily available on the net.*__

Thanks To

  • ๐ŸŒŸ A heartfelt thank you to everyone who contributes to keeping this repository up-to-date! Your support and collaboration are invaluable in managing and tracking all the changes. Your help is greatly appreciated! ๐Ÿ™๐ŸŽ‰

ยฉ 2026 GitRepoTrend ยท leetal/ios-cmake ยท Updated daily from GitHub