aboutsummaryrefslogtreecommitdiff
path: root/docs/yaml
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2023-08-12 10:45:05 +0200
committerEli Schwartz <eschwartz93@gmail.com>2023-08-18 00:36:32 -0400
commit88747b4f8d4bb35c82c8855ecbd6a29ea419b6fd (patch)
treef9d3868ad51208b5efb5e59660f1532586e9c726 /docs/yaml
parent84c8905d527893bedc673e8a036b8b2ec89368b4 (diff)
downloadmeson-88747b4f8d4bb35c82c8855ecbd6a29ea419b6fd.zip
meson-88747b4f8d4bb35c82c8855ecbd6a29ea419b6fd.tar.gz
meson-88747b4f8d4bb35c82c8855ecbd6a29ea419b6fd.tar.bz2
docs: Provide example for feature.disable_auto_if
Diffstat (limited to 'docs/yaml')
-rw-r--r--docs/yaml/objects/feature.yaml14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/yaml/objects/feature.yaml b/docs/yaml/objects/feature.yaml
index a5ae7a6..3e0ae69 100644
--- a/docs/yaml/objects/feature.yaml
+++ b/docs/yaml/objects/feature.yaml
@@ -33,6 +33,20 @@ methods:
| Enabled | Enabled | Enabled |
| Disabled | Disabled | Disabled |
+ example: |
+ `disable_auto_if` is useful to give precedence to mutually exclusive dependencies
+ (that provide the same API) if either or both are available:
+
+ ```
+ # '-Dfoo=auto -Dbar=enabled' will not pick foo even if installed.
+ use_bar = get_option('bar')
+ use_foo = get_option('foo').disable_auto_if(use_bar.enabled())
+ dep_foo = dependency('foo', required: use_foo)
+ if not dep_foo.found()
+ dep_foo = dependency('bar', required: use_bar)
+ endif
+ ```
+
posargs:
value:
type: bool