Merge pull request #1260 from mesonbuild/subproj_defaults
Can set subproject option defaults from command line and master projectpull/1286/head
commit
55cdba635e
6 changed files with 86 additions and 11 deletions
@ -0,0 +1,11 @@ |
||||
project('subproject defaults', 'c', |
||||
default_options : ['defopoverride=defopt', # This should be overridden. |
||||
'fromcmdline=defopt'] # This should get the value set in command line. |
||||
) |
||||
|
||||
subproject('foob', default_options : ['fromspfunc=spfunc', 'fromspfunconly=spfunc']) |
||||
|
||||
assert(get_option('fromcmdline') == 'cmdline', 'Default option defined in cmd line is incorrect: ' + get_option('fromcmdline')) |
||||
assert(get_option('defopoverride') == 'defopt', 'Default option without cmd line override is incorrect: ' + get_option('defopoverride')) |
||||
assert(get_option('fromoptfile') == 'optfile', 'Default value from option file is incorrect: ' + get_option('fromoptfile')) |
||||
|
@ -0,0 +1,3 @@ |
||||
option('defopoverride', type : 'string', value : 'optfile', description : 'A value for overriding.') |
||||
option('fromcmdline', type : 'string', value : 'optfile', description : 'A value for overriding.') |
||||
option('fromoptfile', type : 'string', value : 'optfile', description : 'A value for not overriding.') |
@ -0,0 +1,12 @@ |
||||
project('foob', 'c', |
||||
default_options : ['defopoverride=s_defopt', # This should be overridden. |
||||
'fromspfunc=s_defopt', # This is specified with a default_options kwarg to subproject() |
||||
'fromcmdline=s_defopt'] # This should get the value set in command line. |
||||
) |
||||
|
||||
assert(get_option('fromcmdline') == 's_cmdline', 'Default option defined in cmd line is incorrect: ' + get_option('fromcmdline')) |
||||
assert(get_option('fromspfunc') == 'spfunc', 'Default option set with subproject() incorrect: ' + get_option('fromspfunc')) |
||||
assert(get_option('fromspfunconly') == 'spfunc', 'Default option set with subproject() incorrect: ' + get_option('fromspfunc')) |
||||
assert(get_option('defopoverride') == 's_defopt', 'Default option without cmd line override is incorrect: ' + get_option('defopoverride')) |
||||
assert(get_option('fromoptfile') == 's_optfile', 'Default value from option file is incorrect: ' + get_option('fromoptfile')) |
||||
|
@ -0,0 +1,5 @@ |
||||
option('defopoverride', type : 'string', value : 's_optfile', description : 'A value for overriding.') |
||||
option('fromcmdline', type : 'string', value : 's_optfile', description : 'A value for overriding.') |
||||
option('fromspfunc', type : 'string', value : 's_optfile', description : 'A value for overriding.') |
||||
option('fromspfunconly', type : 'string', value : 's_optfile', description : 'A value for overriding.') |
||||
option('fromoptfile', type : 'string', value : 's_optfile', description : 'A value for not overriding.') |
Loading…
Reference in new issue