1project('feature user option', 'c')
2
3feature_opts = get_option('auto_features')
4required_opt = get_option('required')
5optional_opt = get_option('optional')
6disabled_opt = get_option('disabled')
7
8assert(not feature_opts.enabled(), 'Should be auto option')
9assert(not feature_opts.disabled(), 'Should be auto option')
10assert(feature_opts.auto(), 'Should be auto option')
11
12assert(required_opt.enabled(), 'Should be enabled option')
13assert(not required_opt.disabled(), 'Should be enabled option')
14assert(not required_opt.auto(), 'Should be enabled option')
15
16assert(not optional_opt.enabled(), 'Should be auto option')
17assert(not optional_opt.disabled(), 'Should be auto option')
18assert(optional_opt.auto(), 'Should be auto option')
19
20assert(not disabled_opt.enabled(), 'Should be disabled option')
21assert(disabled_opt.disabled(), 'Should be disabled option')
22assert(not disabled_opt.auto(), 'Should be disabled option')
23
24dep = dependency('threads', required : required_opt)
25assert(dep.found(), 'Should find required "threads" dep')
26
27dep = dependency('threads', required : optional_opt)
28assert(dep.found(), 'Should find optional "threads" dep')
29
30dep = dependency('threads', required : disabled_opt)
31assert(not dep.found(), 'Should not find disabled "threads" dep')
32
33dep = dependency('notfounddep', required : optional_opt)
34assert(not dep.found(), 'Should not find optional "notfounddep" dep')
35
36dep = dependency('notfounddep', required : disabled_opt)
37assert(not dep.found(), 'Should not find disabled "notfounddep" dep')
38
39cc = meson.get_compiler('c')
40lib = cc.find_library('m', required : disabled_opt)
41assert(not lib.found(), 'Should not find "m" library')
42
43cp = find_program('cp', required : disabled_opt)
44assert(not cp.found(), 'Should not find "cp" program')
45
46found = add_languages('cpp', required : disabled_opt)
47assert(not found, 'Should not find "cpp" language')
48