From 88747b4f8d4bb35c82c8855ecbd6a29ea419b6fd Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Sat, 12 Aug 2023 10:45:05 +0200 Subject: docs: Provide example for feature.disable_auto_if --- docs/yaml/objects/feature.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/yaml/objects/feature.yaml b/docs/yaml/objects/feature.yaml index a5ae7a691..3e0ae69df 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 -- cgit v1.2.3