diff options
author | Ruslan Baratov <ruslan_baratov@yahoo.com> | 2019-03-01 15:38:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-05 14:45:50 (GMT) |
commit | f7d602b5727e0fb24124001153d2a981be94993c (patch) | |
tree | 39101b88f1e6588a6a435b62e60c05280cdf5e43 /Help | |
parent | 4a9e2e4f3504b311097aa6715b3ebefa7997fd03 (diff) | |
download | CMake-f7d602b5727e0fb24124001153d2a981be94993c.zip CMake-f7d602b5727e0fb24124001153d2a981be94993c.tar.gz CMake-f7d602b5727e0fb24124001153d2a981be94993c.tar.bz2 |
Help: Example of tweaking iOS/tvOS/watchOS build
CMAKE_OSX_ARCHITECTURES and CMAKE_OSX_DEPLOYMENT_TARGET variables
can be used to tweak iOS/tvOS/watchOS build
Diffstat (limited to 'Help')
-rw-r--r-- | Help/manual/cmake-toolchains.7.rst | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index 9317262..ba44b7f 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -556,6 +556,54 @@ command is sufficient: cmake .. -GXcode -DCMAKE_SYSTEM_NAME=iOS +Variable :variable:`CMAKE_OSX_ARCHITECTURES` can be used to set architectures +for both device and simulator. Variable :variable:`CMAKE_OSX_DEPLOYMENT_TARGET` +can be used to set an iOS/tvOS/watchOS deployment target. + +Next configuration will install fat 5 architectures iOS library +and add the ``-miphoneos-version-min=9.3``/``-mios-simulator-version-min=9.3`` +flags to the compiler: + +.. code-block:: console + + $ cmake -S. -B_builds -GXcode \ + -DCMAKE_SYSTEM_NAME=iOS \ + "-DCMAKE_OSX_ARCHITECTURES=armv7;armv7s;arm64;i386;x86_64" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3 \ + -DCMAKE_INSTALL_PREFIX=`pwd`/_install \ + -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \ + -DCMAKE_IOS_INSTALL_COMBINED=YES + +Example: + +.. code-block:: cmake + + # CMakeLists.txt + cmake_minimum_required(VERSION 3.14) + project(foo) + add_library(foo foo.cpp) + install(TARGETS foo DESTINATION lib) + +Install: + +.. code-block:: console + + $ cmake --build _builds --config Release --target install + +Check library: + +.. code-block:: console + + $ lipo -info _install/lib/libfoo.a + Architectures in the fat file: _install/lib/libfoo.a are: i386 armv7 armv7s x86_64 arm64 + +.. code-block:: console + + $ otool -l _install/lib/libfoo.a | grep -A2 LC_VERSION_MIN_IPHONEOS + cmd LC_VERSION_MIN_IPHONEOS + cmdsize 16 + version 9.3 + Code Signing ^^^^^^^^^^^^ |