diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2021-02-25 11:29:55 +0000 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-02-26 10:15:17 -0500 |
commit | ace22f21a7f0abe9250e673a258e4adf3afa4ac0 (patch) | |
tree | 51ed52296025fc51125e41acabe2eb74d8dd5cc3 /docs | |
parent | c5aee36fa244287d1a840953a62dc2727037952c (diff) | |
download | meson-ace22f21a7f0abe9250e673a258e4adf3afa4ac0.zip meson-ace22f21a7f0abe9250e673a258e4adf3afa4ac0.tar.gz meson-ace22f21a7f0abe9250e673a258e4adf3afa4ac0.tar.bz2 |
meson: add .has_external_property() methods
Useful in case of boolean values to distinguish between a boolean
value having been set in the native/cross file and not having been
provided, which can't be achieved by passing a fallback parameter
to .get_external_property().
Diffstat (limited to 'docs')
-rw-r--r-- | docs/markdown/Reference-manual.md | 7 | ||||
-rw-r--r-- | docs/markdown/snippets/has_external_property.md | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 6669530..b0f5032 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1991,6 +1991,13 @@ the following methods. If `native: false` or not specified, variable is retrieved from the cross-file if cross-compiling, and from the native-file when not cross-compiling. +- `has_external_property(propname, native: true/false)` + *(since 0.58.0)*: checks whether the given property exist in a native or + cross file. The optional `native: true` forces checking for the variable + in the native file, even when cross-compiling. + If `native: false` or not specified, the variable is checked for in the + cross-file if cross-compiling, and in the native-file when not cross-compiling. + - `can_run_host_binaries()` *(since 0.55.0)*: returns true if the build machine can run binaries compiled for the host. This returns true unless you are cross compiling, need a helper to run host binaries, and don't have one. diff --git a/docs/markdown/snippets/has_external_property.md b/docs/markdown/snippets/has_external_property.md new file mode 100644 index 0000000..8a815d7 --- /dev/null +++ b/docs/markdown/snippets/has_external_property.md @@ -0,0 +1,7 @@ +## Check if native or cross-file properties exist + +It is now possible to check whether a native property or a cross-file property +exists with `meson.has_external_property('foo')`. This is useful if the +property in question is a boolean and one wants to distinguish between +"set" and "not provided" which can't be done the usual way by passing a +fallback parameter to `meson.get_external_property()` in this particular case. |