diff options
| author | Paolo Bonzini <pbonzini@redhat.com> | 2021-05-16 17:54:43 +0200 |
|---|---|---|
| committer | Paolo Bonzini <pbonzini@redhat.com> | 2021-06-08 10:18:12 +0200 |
| commit | a87e32d1817ba750b054774e589b595135fb9145 (patch) | |
| tree | 2118719c756142508f3b5f84cd59dbc6d6aa8f3c /data | |
| parent | 2f2d99e1d88c9f14fa139d450cb6f55173d73c9a (diff) | |
| download | meson-a87e32d1817ba750b054774e589b595135fb9145.tar.gz | |
interpreter: add feature.disable_auto_if()
Add a method to downgrade an option to disabled if it is not used.
This is useful to avoid unnecessary search for dependencies;
for example
dep = dependency('dep', required: get_option('feature').disable_auto_if(not foo))
can be used instead of the more verbose and complex
if get_option('feature').auto() and not foo then
dep = dependency('', required: false)
else
dep = dependency('dep', required: get_option('feature'))
endif
or to avoid unnecessary dependency searches:
dep1 = dependency('dep1', required: get_option('foo'))
# dep2 is only used together with dep1
dep2 = dependency('dep2', required: get_option('foo').disable_auto_if(not dep1.found()))
```
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'data')
0 files changed, 0 insertions, 0 deletions
