aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/CMake-module.md
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-10-13 23:38:51 +0300
committerGitHub <noreply@github.com>2020-10-13 23:38:51 +0300
commit3372c58ca633e2bc7d5b36bcd7e0d14d12e0f82a (patch)
treee0af9977e708170d136104e4eb056b6f9f31eda0 /docs/markdown/CMake-module.md
parent55cf399ff8b9c15300f26dd1a46045dda7d49f98 (diff)
parentf5c9bf96b370832fc1a6e50771e2c171de0cd79d (diff)
downloadmeson-3372c58ca633e2bc7d5b36bcd7e0d14d12e0f82a.zip
meson-3372c58ca633e2bc7d5b36bcd7e0d14d12e0f82a.tar.gz
meson-3372c58ca633e2bc7d5b36bcd7e0d14d12e0f82a.tar.bz2
Merge pull request #7816 from mensinda/cmCross
cmake: Cross compilation support
Diffstat (limited to 'docs/markdown/CMake-module.md')
-rw-r--r--docs/markdown/CMake-module.md37
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/markdown/CMake-module.md b/docs/markdown/CMake-module.md
index fc6157e..48c3d75 100644
--- a/docs/markdown/CMake-module.md
+++ b/docs/markdown/CMake-module.md
@@ -176,6 +176,43 @@ Options that are not set won't affect the generated subproject. So, if for
instance, `set_install` was not called then the values extracted from CMake will
be used.
+### Cross compilation
+
+*New in 0.56.0*
+
+Meson will try to automatically guess most of the required CMake toolchain
+variables from existing entries in the cross and native files. These variables
+will be stored in an automatically generate CMake toolchain file in the build
+directory. The remaining variables that can't be guessed can be added by the
+user in the `[cmake]` cross/native file section (*new in 0.56.0*).
+
+Adding a manual CMake toolchain file is also supported with the
+`cmake_toolchain_file` setting in the `[properties]` section. Directly setting
+a CMake toolchain file with `-DCMAKE_TOOLCHAIN_FILE=/path/to/some/Toolchain.cmake`
+in the `meson.build` is **not** supported since the automatically generated
+toolchain file is also used by Meson to inject arbitrary code into CMake to
+enable the CMake subproject support.
+
+The closest configuration to only using a manual CMake toolchain file would be
+to set these options in the machine file:
+
+```ini
+[properties]
+
+cmake_toolchain_file = '/path/to/some/Toolchain.cmake'
+cmake_defaults = false
+
+[cmake]
+
+# No entries in this section
+```
+
+This will result in a toolchain file with just the bare minimum to enable the
+CMake subproject support and `include()` the `cmake_toolchain_file` as the
+last instruction.
+
+For more information see the [cross and native file specification](Machine-files.md).
+
## CMake configuration files
### cmake.write_basic_package_version_file()