build: Set default CFLAGS using meson's c_args

Meson supports checking for default arguments natively without having to
do this for each one, so just use this feature.

Not doing this will become a warning as per meson 0.52.0 [1].

[1] https://github.com/mesonbuild/meson/pull/5627
This commit is contained in:
Marco Trevisan (Treviño)
2020-03-30 22:01:38 +02:00
parent 90298134a2
commit 3dd0018f23

View File

@ -5,28 +5,7 @@ project('fprintd', 'c',
'buildtype=debugoptimized',
'warning_level=1',
'c_std=gnu99',
],
meson_version: '>= 0.50.0')
gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')
host_system = host_machine.system()
glib_min_version = '2.56'
libfprint_min_version = '1.90.0'
fprintd_installdir = get_option('prefix') / get_option('libexecdir')
fprintd_plugindir = get_option('prefix') / get_option('libdir') / meson.project_name() / 'modules'
storage_path = get_option('prefix') / get_option('localstatedir') / 'lib/fprint'
localedir = get_option('prefix') / get_option('localedir')
datadir = get_option('prefix') / get_option('datadir')
sysconfdir = get_option('sysconfdir')
if get_option('prefix') != '/usr'
sysconfdir = get_option('prefix') / sysconfdir
endif
common_cflags = cc.get_supported_arguments([
'c_args=' + ' '.join([
'-fno-strict-aliasing',
'-Wall',
'-Wcast-align',
@ -64,8 +43,27 @@ common_cflags = cc.get_supported_arguments([
'-Wtype-limits',
'-Wundef',
'-Wunused',
])
add_project_arguments(common_cflags, language: 'c')
]),
],
meson_version: '>= 0.50.0')
gnome = import('gnome')
i18n = import('i18n')
cc = meson.get_compiler('c')
host_system = host_machine.system()
glib_min_version = '2.56'
libfprint_min_version = '1.90.0'
fprintd_installdir = get_option('prefix') / get_option('libexecdir')
fprintd_plugindir = get_option('prefix') / get_option('libdir') / meson.project_name() / 'modules'
storage_path = get_option('prefix') / get_option('localstatedir') / 'lib/fprint'
localedir = get_option('prefix') / get_option('localedir')
datadir = get_option('prefix') / get_option('datadir')
sysconfdir = get_option('sysconfdir')
if get_option('prefix') != '/usr'
sysconfdir = get_option('prefix') / sysconfdir
endif
# Dependencies
glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)