aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-06-08 12:37:25 +0300
committerGitHub <noreply@github.com>2021-06-08 12:37:25 +0300
commita4a61b6bf8b7659a799dd31dd4f989056b1ccc00 (patch)
tree40675c93feec9a0e0e310b01e6bcb8c41a6dc7ea /docs
parent98efec5c2b1ede3133470c0fc27e70b2ea4aa731 (diff)
parent6497e52035509a2669720b03bd166a50a834c784 (diff)
downloadmeson-a4a61b6bf8b7659a799dd31dd4f989056b1ccc00.zip
meson-a4a61b6bf8b7659a799dd31dd4f989056b1ccc00.tar.gz
meson-a4a61b6bf8b7659a799dd31dd4f989056b1ccc00.tar.bz2
Merge pull request #8512 from bonzini/feature-methods
Utility methods for feature objects
Diffstat (limited to 'docs')
-rw-r--r--docs/markdown/Reference-manual.md25
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 103f4d8..111a6f0 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -2818,6 +2818,31 @@ The following methods are defined for all [`feature` options](Build-options.md#f
- `enabled()`: returns whether the feature was set to `'enabled'`
- `disabled()`: returns whether the feature was set to `'disabled'`
- `auto()`: returns whether the feature was set to `'auto'`
+- `allowed()` *(since 0.59.0)*: returns whether the feature was set to `'enabled'` or `'auto'`
+- `disable_auto_if(value)` *(since 0.59.0)*: returns the feature, with
+ `'auto'` converted to `'disabled'` if value is true.
+
+ | Feature / Condition | True | False |
+ | ------------------- | ---- | ----- |
+ | Enabled | Enabled | Enabled |
+ | Disabled | Disabled | Disabled |
+ | Auto | Disabled | Auto |
+
+- `require(value, error_message: '')` *(since 0.59.0)*: returns
+ the object itself if the value is true; an error if the object is
+ `'enabled'` and the value is false; a disabled feature if the object
+ is `'auto'` or `'disabled'` and the value is false.
+
+`require` is useful to restrict the applicability of `'auto'` features,
+for example based on other features or on properties of the host machine:
+
+```
+if get_option('directx').require(host_machine.system() == 'windows',
+ error_message: 'DirectX only available on Windows').allowed() then
+ src += ['directx.c']
+ config.set10('HAVE_DIRECTX', 1)
+endif
+```
### `generator` object