meson: always allow compilation of tests binaries

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-09-12 16:52:08 +02:00
parent 15c5594bec
commit 3b2bdd625a

View file

@ -274,12 +274,10 @@ want_tests = get_option('tests')
slow_tests = want_tests != 'false' and get_option('slow-tests') slow_tests = want_tests != 'false' and get_option('slow-tests')
install_tests = get_option('install-tests') install_tests = get_option('install-tests')
if want_tests != 'false' cxx = find_program('c++', required : false)
cxx = find_program('c++', required : false) if cxx.found()
if cxx.found() # Used only for tests
# Used only for tests add_languages('cpp')
add_languages('cpp')
endif
endif endif
want_ossfuzz = get_option('oss-fuzz') want_ossfuzz = get_option('oss-fuzz')
@ -2640,9 +2638,8 @@ foreach tuple : tests
timeout = type.split('=')[1].to_int() timeout = type.split('=')[1].to_int()
type = '' type = ''
endif endif
if want_tests == 'false'
message('Not compiling @0@ because tests is set to false'.format(name)) if condition == '' or conf.get(condition) == 1
elif condition == '' or conf.get(condition) == 1
exe = executable( exe = executable(
name, name,
sources, sources,
@ -2650,6 +2647,7 @@ foreach tuple : tests
link_with : link_with, link_with : link_with,
dependencies : dependencies, dependencies : dependencies,
c_args : defs, c_args : defs,
build_by_default : want_tests != 'false',
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : install_tests, install : install_tests,
install_dir : join_paths(testsdir, type)) install_dir : join_paths(testsdir, type))
@ -2658,7 +2656,7 @@ foreach tuple : tests
message('@0@ is a manual test'.format(name)) message('@0@ is a manual test'.format(name))
elif type == 'unsafe' and want_tests != 'unsafe' elif type == 'unsafe' and want_tests != 'unsafe'
message('@0@ is an unsafe test'.format(name)) message('@0@ is an unsafe test'.format(name))
else elif want_tests != 'false'
test(name, exe, test(name, exe,
env : test_env, env : test_env,
timeout : timeout) timeout : timeout)