meson: use cross compilation compatible c++ check

This commit is contained in:
James Hilliard 2018-12-27 09:16:20 +08:00 committed by Yu Watanabe
parent 8eab766804
commit 46e63a2a3e
3 changed files with 3 additions and 6 deletions

View file

@ -287,10 +287,8 @@ 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')
cxx = find_program('c++', required : fuzzer_build) if add_languages('cpp', required : fuzzer_build)
if cxx.found()
# Used only for tests # Used only for tests
add_languages('cpp')
cxx_cmd = ' '.join(meson.get_compiler('cpp').cmd_array()) cxx_cmd = ' '.join(meson.get_compiler('cpp').cmd_array())
else else
cxx_cmd = '' cxx_cmd = ''

View file

@ -52,8 +52,7 @@ if cc.has_argument('-std=iso9899:2017')
opts += [['c', '-std=iso9899:2017']] opts += [['c', '-std=iso9899:2017']]
endif endif
cxx = find_program('c++', required : false) if add_languages('cpp', required : false)
if cxx.found()
opts += [['c++'], opts += [['c++'],
['c++', '-std=c++98'], ['c++', '-std=c++98'],
['c++', '-std=c++11']] ['c++', '-std=c++11']]

View file

@ -957,7 +957,7 @@ tests += [
] ]
if cxx.found() if cxx_cmd != ''
tests += [ tests += [
[['src/libsystemd/sd-bus/test-bus-vtable-cc.cc'], [['src/libsystemd/sd-bus/test-bus-vtable-cc.cc'],
[], [],