| 1 |
name: get_option |
| 2 |
returns: str | int | bool | feature | list[str | int | bool] |
| 3 |
description: | |
| 4 |
Obtains the value of the [project build option](Build-options.md) |
| 5 |
specified in the positional argument. |
| 6 |
|
| 7 |
Note that the value returned for built-in options that end in `dir` |
| 8 |
such as `bindir` and `libdir` is usually a path relative to (and |
| 9 |
inside) the `prefix` but you should not rely on that, as it can also |
| 10 |
be an absolute path [in some cases](Builtin-options.md#universal-options). |
| 11 |
[`install_dir` arguments](Installing.md) handle that as expected |
| 12 |
but if you need an absolute path, e.g. to use in a define etc., |
| 13 |
you should use the path concatenation operator like this: |
| 14 |
`get_option('prefix') / get_option('localstatedir')`. |
| 15 |
Never manually join paths as if they were strings. |
| 16 |
|
| 17 |
For options of type `feature` a |
| 18 |
[[@feature]] option object |
| 19 |
is returned instead of a string. |
| 20 |
See [`feature` options](Build-options.md#features) |
| 21 |
documentation for more details. |
| 22 |
|
| 23 |
posargs: |
| 24 |
option_name: |
| 25 |
type: str |
| 26 |
description: Name of the option to query |