diff options
| author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-01-03 16:03:18 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-03 16:03:18 -0500 |
| commit | 55cdba635e61b68658e0d209a58cfb2f1537df93 (patch) | |
| tree | 03ce2b4ba4aace32f64f8c43478ba60366fdac72 /test cases/unit | |
| parent | 5ff97b0f357a79556667668e06914a50970f86d6 (diff) | |
| parent | d94f64ded1382ff768ce2c2900a8e6efcf3a11fb (diff) | |
| download | meson-55cdba635e61b68658e0d209a58cfb2f1537df93.tar.gz | |
Merge pull request #1260 from mesonbuild/subproj_defaults
Can set subproject option defaults from command line and master project
Diffstat (limited to 'test cases/unit')
4 files changed, 31 insertions, 0 deletions
diff --git a/test cases/unit/3 subproject defaults/meson.build b/test cases/unit/3 subproject defaults/meson.build new file mode 100644 index 000000000..3bf05d036 --- /dev/null +++ b/test cases/unit/3 subproject defaults/meson.build @@ -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')) + diff --git a/test cases/unit/3 subproject defaults/meson_options.txt b/test cases/unit/3 subproject defaults/meson_options.txt new file mode 100644 index 000000000..b63f512e2 --- /dev/null +++ b/test cases/unit/3 subproject defaults/meson_options.txt @@ -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.') diff --git a/test cases/unit/3 subproject defaults/subprojects/foob/meson.build b/test cases/unit/3 subproject defaults/subprojects/foob/meson.build new file mode 100644 index 000000000..69f01d1ba --- /dev/null +++ b/test cases/unit/3 subproject defaults/subprojects/foob/meson.build @@ -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')) + diff --git a/test cases/unit/3 subproject defaults/subprojects/foob/meson_options.txt b/test cases/unit/3 subproject defaults/subprojects/foob/meson_options.txt new file mode 100644 index 000000000..a9a615e5e --- /dev/null +++ b/test cases/unit/3 subproject defaults/subprojects/foob/meson_options.txt @@ -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.') |
