diff --git a/meson.build b/meson.build index 924274de630..5066ccf4323 100644 --- a/meson.build +++ b/meson.build @@ -260,10 +260,12 @@ cc = meson.get_compiler('c') pkgconfig = import('pkgconfig') check_compilation_sh = find_program('tools/meson-check-compilation.sh') -cxx = find_program('c++', required : false) -if cxx.found() - # Used only for tests - add_languages('cpp') +if get_option('tests') != 'false' + cxx = find_program('c++', required : false) + if cxx.found() + # Used only for tests + add_languages('cpp') + endif endif foreach arg : ['-Wextra', @@ -2404,8 +2406,9 @@ foreach tuple : tests timeout = type.split('=')[1].to_int() type = '' endif - - if condition == '' or conf.get(condition) == 1 + if want_tests == 'false' + message('Not compiling @0@ because tests is set to false'.format(name)) + elif condition == '' or conf.get(condition) == 1 exe = executable( name, sources, diff --git a/meson_options.txt b/meson_options.txt index f71755cfa6c..af8be576a10 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -285,7 +285,7 @@ option('bashcompletiondir', type : 'string', option('zshcompletiondir', type : 'string', description : 'directory for zsh completion scripts ["no" disables]') -option('tests', type : 'combo', choices : ['true', 'unsafe'], +option('tests', type : 'combo', choices : ['true', 'unsafe', 'false'], description : 'enable extra tests with =unsafe') option('slow-tests', type : 'boolean', value : 'false', description : 'run the slow tests by default')