aboutsummaryrefslogtreecommitdiff
path: root/docs/markdown/snippets/project_options_in_machine_files.md
blob: 78b129aa34ef5ece0b0585f5788ebebde0b5b296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Project options can be set in native or cross files

A new set of sections has been added to the cross and native files, `[project
options]` and `[<subproject_name>:project options]`, where `subproject_name`
is the name of a subproject. Any options that are allowed in the project can
be set from this section. They have the lowest precedent, and will be
overwritten by command line arguments.


```meson
option('foo', type : 'string', value : 'foo')
```

```ini
[project options]
foo = 'other val'
```

```console
meson build --native-file my.ini
```

Will result in the option foo having the value `other val`,

```console
meson build --native-file my.ini -Dfoo='different val'
```

Will result in the option foo having the value `different val`,


Subproject options are assigned like this:

```ini
[zlib:project options]
foo = 'some val'
```