diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2022-12-21 09:55:26 -0800 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-02-15 22:58:50 -0500 |
| commit | 3589815eb9dd8402deabedcd4492f33e04870c56 (patch) | |
| tree | a039f474889d4be7b639dfacabb5d0b1163d80e4 /docs | |
| parent | a3098fbfa32ae4ff654f0da45bcfcd9aa7893b5f (diff) | |
| download | meson-3589815eb9dd8402deabedcd4492f33e04870c56.tar.gz | |
interpreter: add a feature.enable_auto_if
It's always been strange to me we don't have an opposite method of the
`disable_auto_if` method, but I've been pressed to find a case where we
_need_ one, because `disable_auto_if` can't be logically contorted to
work. I finally found the case where they're not equivalent: when you
don't want to convert to a boolean:
```meson
f = get_option('feat').disable_auto_if(not foo)
g = get_option('feat').enable_auto_if(foo)
dep1 = dependency('foo', required : f)
dep2 = dependency('foo', required : g)
```
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/markdown/snippets/feature_enable_auto_if.md | 4 | ||||
| -rw-r--r-- | docs/yaml/objects/feature.yaml | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/docs/markdown/snippets/feature_enable_auto_if.md b/docs/markdown/snippets/feature_enable_auto_if.md new file mode 100644 index 000000000..546100429 --- /dev/null +++ b/docs/markdown/snippets/feature_enable_auto_if.md @@ -0,0 +1,4 @@ +## Feature objects now have an enable_auto_if method + +This performs the opposite task of the disable_auto_if method, enabling the +feature if the condition is true. diff --git a/docs/yaml/objects/feature.yaml b/docs/yaml/objects/feature.yaml index b6a754b72..01209eb53 100644 --- a/docs/yaml/objects/feature.yaml +++ b/docs/yaml/objects/feature.yaml @@ -38,6 +38,23 @@ methods: type: bool description: See the table above +- name: enable_auto_if + since: 1.1.0 + returns: feature + description: | + Returns the feature, with `'auto'` converted to `'enabled'` if value is true. + + | Feature / Condition | `value = true` | `value = false` | + | ------------------- | -------------- | --------------- | + | Enabled | Enabled | Enabled | + | Disabled | Disabled | Disabled | + | Auto | Enabled | Auto | + + posargs: + value: + type: bool + description: See the table above + - name: require returns: feature since: 0.59.0 |
