Skip to content

Commit 5478113

Browse files
bonzinijpakkane
authored andcommitted
docs: document order in which options are applied
Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 5061a80 commit 5478113

File tree

1 file changed

+38
-21
lines changed

1 file changed

+38
-21
lines changed

docs/markdown/Builtin-options.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,28 @@ Options that are labeled "per machine" in the table are set per
7272
machine. See the [specifying options per
7373
machine](#specifying-options-per-machine) section for details.
7474

75-
| Option | Default value | Description | Is per machine | Is per subproject |
76-
| -------------------------------------- | ------------- | ----------- | -------------- | ----------------- |
75+
| Option | Default value | Description | Is per machine | Per subproject (since) |
76+
| -------------------------------------- | ------------- | ----------- | -------------- | ---------------------- |
7777
| auto_features {enabled, disabled, auto} | auto | Override value of all 'auto' features | no | no |
7878
| backend {ninja, vs,<br>vs2010, vs2012, vs2013, vs2015, vs2017, vs2019, vs2022, xcode, none} | ninja | Backend to use | no | no |
7979
| genvslite {vs2022} | vs2022 | Setup multi-buildtype ninja build directories and Visual Studio solution | no | no |
80-
| buildtype {plain, debug,<br>debugoptimized, release, minsize, custom} | debug | Build type to use | no | no |
81-
| debug | true | Enable debug symbols and other information | no | no |
82-
| default_both_libraries {shared, static, auto} | shared | Default library type for both_libraries | no | no |
83-
| default_library {shared, static, both} | shared | Default library type | no | yes |
80+
| buildtype {plain, debug,<br>debugoptimized, release, minsize, custom} | debug | Build type to use | no | 1.8.0 |
81+
| debug | true | Enable debug symbols and other information | no | 1.8.0 |
82+
| default_both_libraries {shared, static, auto} | shared | Default library type for both_libraries | no | 1.8.0 |
83+
| default_library {shared, static, both} | shared | Default library type | no | 0.54.0 |
8484
| errorlogs | true | Whether to print the logs from failing tests. | no | no |
8585
| install_umask {preserve, 0000-0777} | 022 | Default umask to apply on permissions of installed files | no | no |
8686
| layout {mirror,flat} | mirror | Build directory layout | no | no |
87-
| optimization {plain, 0, g, 1, 2, 3, s} | 0 | Optimization level | no | no |
87+
| optimization {plain, 0, g, 1, 2, 3, s} | 0 | Optimization level | no | 1.8.0 |
8888
| pkg_config_path {OS separated path} | '' | Additional paths for pkg-config to search before builtin paths | yes | no |
8989
| prefer_static | false | Whether to try static linking before shared linking | no | no |
9090
| cmake_prefix_path | [] | Additional prefixes for cmake to search before builtin paths | yes | no |
9191
| stdsplit | true | Split stdout and stderr in test logs | no | no |
92-
| strip | false | Strip targets on install | no | no |
93-
| unity {on, off, subprojects} | off | Unity build | no | no |
94-
| unity_size {>=2} | 4 | Unity file block size | no | no |
95-
| warning_level {0, 1, 2, 3, everything} | 1 | Set the warning level. From 0 = compiler default to everything = highest | no | yes |
96-
| werror | false | Treat warnings as errors | no | yes |
92+
| strip | false | Strip targets on install | no | 1.8.0 |
93+
| unity {on, off, subprojects} | off | Unity build | no | 1.8.0 |
94+
| unity_size {>=2} | 4 | Unity file block size | no | 1.8.0 |
95+
| warning_level {0, 1, 2, 3, everything} | 1 | Set the warning level. From 0 = compiler default to everything = highest | no | 0.56.0 |
96+
| werror | false | Treat warnings as errors | no | 0.54.0 |
9797
| wrap_mode {default, nofallback,<br>nodownload, forcefallback, nopromote} | default | Wrap mode to use | no | no |
9898
| force_fallback_for | [] | Force fallback for those dependencies | no | no |
9999
| vsenv | false | Activate Visual Studio environment | no | no |
@@ -370,24 +370,41 @@ allowing differences in behavior to crop out.
370370

371371
## Specifying options per subproject
372372

373-
Since *0.54.0* `default_library` and `werror` built-in options can be
374-
defined per subproject. This is useful, for example, when building
375-
shared libraries in the main project and statically linking a subproject,
376-
or when the main project must build with no warnings but some subprojects
377-
cannot.
373+
Several built-in options and all compiler options can be defined per subproject.
374+
This is useful, for example, when building shared libraries in the main project
375+
and statically linking a subproject, or when the main project must build
376+
with no warnings but some subprojects cannot.
378377

379378
Most of the time, this would be used either in the parent project by
380379
setting subproject's default_options (e.g. `subproject('foo',
381380
default_options: 'default_library=static')`), or by the user through the
382381
command line: `-Dfoo:default_library=static`.
383382

384383
The value is overridden in this order:
384+
- `opt=value` from parent project's `default_options`
385+
- `opt=value` from subproject's `default_options`
386+
- `subp:opt=value` from parent project's default options
387+
- `opt=value` from `subproject()` `default_options`
388+
- `opt=value` from machine file
389+
- `opt=value` from command line
390+
- `subp:opt=value` from machine file
391+
- `subp:opt=value` from command line
392+
393+
### Old behavior
394+
395+
Between *0.54.0* and *1.7.x* only a few options could be defined per subproject:
396+
* `default_library` and `werror` since *0.54.0*;
397+
* `warning_level` since *0.56.0*;
398+
* compiler options since *0.63.0*
399+
400+
The value was overridden in this order:
401+
385402
- Value from parent project
386-
- Value from subproject's default_options if set
387-
- Value from subproject() default_options if set
388-
- Value from command line if set
403+
- Value from subproject's `default_options`
404+
- Value from `subproject()` `default_options`
405+
- Value from machine file
406+
- Value from command line
389407

390-
Since *0.56.0* `warning_level` can also be defined per subproject.
391408

392409
## Module options
393410

0 commit comments

Comments
 (0)