diff options
Diffstat (limited to 'meson/test cases/common/87 default options')
3 files changed, 37 insertions, 0 deletions
diff --git a/meson/test cases/common/87 default options/meson.build b/meson/test cases/common/87 default options/meson.build new file mode 100644 index 000000000..51b5cdac9 --- /dev/null +++ b/meson/test cases/common/87 default options/meson.build @@ -0,0 +1,33 @@ +project('default options', 'cpp', 'c', default_options : [ + 'prefix=/absoluteprefix', + 'buildtype=debugoptimized', + 'cpp_std=c++11', + 'cpp_eh=none', + 'warning_level=3', + 'sub1:test_option=false', + ]) + +assert(get_option('buildtype') == 'debugoptimized', 'Build type default value wrong.') + +cpp_eh = get_option('cpp_eh') +assert(cpp_eh == 'none', 'EH value is "' + cpp_eh + '" instead of "none"') +cpp_std = get_option('cpp_std') +assert(cpp_std == 'c++11', 'C++ std value is "' + cpp_std + '" instead of c++11.') + +w_level = get_option('warning_level') +assert(w_level == '3', 'warning level "' + w_level + '" instead of "3"') + +# FIXME. Since we no longer accept invalid options to c_std etc, +# there is no simple way to test this. Gcc does not seem to expose +# the C std used in a preprocessor token so we can't check for it. +# Think of a way to fix this. +# +# # Verify that project args are not used when told not to. +# # MSVC plain C does not have a simple arg to test so skip it. +# if cpp.get_id() != 'msvc' +# cc = meson.get_compiler('c') +# assert(not cc.compiles('int foobar;'), 'Default arg not used in test.') +# assert(cc.compiles('int foobar;', no_builtin_args : true), 'No_builtin did not disable builtins.') +# endif + +subproject('sub1') diff --git a/meson/test cases/common/87 default options/subprojects/sub1/meson.build b/meson/test cases/common/87 default options/subprojects/sub1/meson.build new file mode 100644 index 000000000..de0dc216c --- /dev/null +++ b/meson/test cases/common/87 default options/subprojects/sub1/meson.build @@ -0,0 +1,3 @@ +project('sub1') + +assert(get_option('test_option') == false) diff --git a/meson/test cases/common/87 default options/subprojects/sub1/meson_options.txt b/meson/test cases/common/87 default options/subprojects/sub1/meson_options.txt new file mode 100644 index 000000000..fc96f5e09 --- /dev/null +++ b/meson/test cases/common/87 default options/subprojects/sub1/meson_options.txt @@ -0,0 +1 @@ +option('test_option', type : 'boolean', value : true, description : 'Test option. Superproject overrides default to "false"') |