diff options
author | Brad King <brad.king@kitware.com> | 2018-01-22 15:12:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-01-22 15:12:21 (GMT) |
commit | 856dc73e024672e650bb47a9b4acd898ad54008e (patch) | |
tree | a3d521e76b4a6e950c57cd09847237768139f4dd | |
parent | 6ab316c98da3cb928c83a0b9fdda98c99e749eca (diff) | |
parent | 60febda45541c65e0ca7fb4535c629c77c17e13a (diff) | |
download | CMake-856dc73e024672e650bb47a9b4acd898ad54008e.zip CMake-856dc73e024672e650bb47a9b4acd898ad54008e.tar.gz CMake-856dc73e024672e650bb47a9b4acd898ad54008e.tar.bz2 |
Merge topic 'docs_cmake_crosscompiling'
60febda4 Help: Explain meaning and limitations of CMAKE_CROSSCOMPILING
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1672
-rw-r--r-- | Help/variable/CMAKE_CROSSCOMPILING.rst | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Help/variable/CMAKE_CROSSCOMPILING.rst b/Help/variable/CMAKE_CROSSCOMPILING.rst index cf9865b..9e96769 100644 --- a/Help/variable/CMAKE_CROSSCOMPILING.rst +++ b/Help/variable/CMAKE_CROSSCOMPILING.rst @@ -1,8 +1,26 @@ CMAKE_CROSSCOMPILING -------------------- -Is CMake currently cross compiling. +Intended to indicate whether CMake is cross compiling, but note limitations +discussed below. -This variable will be set to true by CMake if CMake is cross -compiling. Specifically if the build platform is different from the -target platform. +This variable will be set to true by CMake if the :variable:`CMAKE_SYSTEM_NAME` +variable has been set manually (i.e. in a toolchain file or as a cache entry +from the :manual:`cmake <cmake(1)>` command line). In most cases, manually +setting :variable:`CMAKE_SYSTEM_NAME` will only be done when cross compiling, +since it will otherwise be given the same value as +:variable:`CMAKE_HOST_SYSTEM_NAME` if not manually set, which is correct for +the non-cross-compiling case. In the event that :variable:`CMAKE_SYSTEM_NAME` +is manually set to the same value as :variable:`CMAKE_HOST_SYSTEM_NAME`, then +``CMAKE_CROSSCOMPILING`` will still be set to true. + +Another case to be aware of is that builds targeting Apple platforms other than +macOS are handled differently to other cross compiling scenarios. Rather than +relying on :variable:`CMAKE_SYSTEM_NAME` to select the target platform, Apple +device builds use :variable:`CMAKE_OSX_SYSROOT` to select the appropriate SDK, +which indirectly determines the target platform. Furthermore, when using the +Xcode generator, developers can switch between device and simulator builds at +build time rather than having a single choice at configure time, so the concept +of whether the build is cross compiling or not is more complex. Therefore, the +use of ``CMAKE_CROSSCOMPILING`` is not recommended for projects targeting Apple +devices. |