pull/3031/head
parent
0204895143
commit
54d7817087
9 changed files with 90 additions and 25 deletions
@ -0,0 +1,8 @@ |
||||
## Yielding subproject option to superproject |
||||
|
||||
Normally project options are specific to the current project. However |
||||
sometimes you want to have an option whose value is the same over all |
||||
projects. This can be achieved with the new `yield` keyword for |
||||
options. When set to `true`, getting the value of this option in |
||||
`meson.build` files gets the value from the option with the same name |
||||
in the master project (if such an option exists). |
@ -0,0 +1,6 @@ |
||||
project('yield_options', 'c') |
||||
|
||||
subproject('sub') |
||||
|
||||
assert(get_option('unshared_option') == 'one', 'Unshared option has wrong value in superproject.') |
||||
assert(get_option('shared_option') == 'two', 'Unshared option has wrong value in superproject..') |
@ -0,0 +1,2 @@ |
||||
option('unshared_option', type : 'string', value : 'one') |
||||
option('shared_option', type : 'string', value : 'two') |
@ -0,0 +1,4 @@ |
||||
project('subbie', 'c') |
||||
|
||||
assert(get_option('unshared_option') == 'three', 'Unshared option has wrong value in subproject.') |
||||
assert(get_option('shared_option') == 'two', 'Shared option has wrong value in subproject.') |
@ -0,0 +1,2 @@ |
||||
option('unshared_option', type : 'string', value : 'three', yield : false) |
||||
option('shared_option', type : 'string', value : 'four', yield : true) |
Loading…
Reference in new issue