meson: fix build without cpp toolchain

We don't need a cpp toolchain for building glib so lets just
automatically disable tests requiring one when not available.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
This commit is contained in:
James Hilliard
2022-07-15 00:23:37 -06:00
parent 28c07dc966
commit d0b9ebbaac
6 changed files with 57 additions and 26 deletions

View File

@@ -45,8 +45,12 @@ extra_c_args = cc.get_supported_arguments('-Werror=unused-function')
# Links in a static library provided by oss-fuzz, else a standalone driver.
# https://google.github.io/oss-fuzz/getting-started/new-project-guide/#buildsh-script-environment
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
if fuzzing_engine.found()
have_fuzzing_engine = false
if have_cxx
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
have_fuzzing_engine = fuzzing_engine.found()
endif
if have_fuzzing_engine
deps += fuzzing_engine
else
extra_sources += 'driver.c'
@@ -61,7 +65,7 @@ foreach target_name : fuzz_targets
# If the FuzzingEngine isnt available, build some unit tests to check that
# the fuzzing files do basically work. This doesnt do any actual fuzzing though.
# Pass in the README as an arbitrary fuzzing input, just so we have something.
if not fuzzing_engine.found()
if not have_fuzzing_engine
test(target_name, exe,
args : files('README.md'),
suite : 'fuzzing',