meson.build: fix build with gcc < 7

Test if arguments (e.g. -Wimplicit-fallthrough) is available before
using it as -Wimplicit-fallthrough has been added only since gcc 7.1 and
81fea426da
and so it will raise the following build failure with gcc < 7:

arm-none-linux-gnueabi-gcc: error: unrecognized command line option '-Wimplicit-fallthrough'

Fixes:
 - http://autobuild.buildroot.org/results/0ee6816a7cceebdafd07612677a594bdf68e0790

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
This commit is contained in:
Fabrice Fontaine 2021-08-08 19:00:35 +02:00 committed by Kenny Levinsen
parent 038c30f9b1
commit 15b0972bd3

View file

@ -22,7 +22,8 @@ if defaultpath == ''
endif
endif
add_project_arguments(
cc = meson.get_compiler('c')
add_project_arguments(cc.get_supported_arguments(
[
'-Wundef',
'-Wunused',
@ -41,7 +42,7 @@ add_project_arguments(
'-D__BSD_VISIBLE',
'-DSEATD_VERSION="@0@"'.format(meson.project_version()),
'-DSEATD_DEFAULTPATH="@0@"'.format(defaultpath)
],
]),
language: 'c',
)