meson: Use add_project_arguments for common cflags

We were passing around the common cflags and setting them for each library
or executable, but this is just a repetition given we can just use
add_project_arguments for this.
This commit is contained in:
Marco Trevisan (Treviño) 2019-12-04 12:32:14 +01:00
parent 44af2173a8
commit 7e70344b4a
4 changed files with 12 additions and 14 deletions

View file

@ -13,10 +13,7 @@ executable('gtk-libfprint-test',
include_directories: [
root_inc,
],
c_args: [
common_cflags,
'-DPACKAGE_VERSION="' + meson.project_version() + '"'
],
c_args: '-DPACKAGE_VERSION="' + meson.project_version() + '"',
install: true,
install_dir: bindir)

View file

@ -6,8 +6,7 @@ foreach example: examples
dependencies: [ libfprint_dep, glib_dep ],
include_directories: [
root_inc,
],
c_args: common_cflags)
])
endforeach
executable('cpp-test',
@ -15,5 +14,4 @@ executable('cpp-test',
dependencies: libfprint_dep,
include_directories: [
root_inc,
],
c_args: common_cflags)
])

View file

@ -188,7 +188,7 @@ libfprint = library('fprint',
drivers_sources + nbis_sources + other_sources,
soversion: soversion,
version: libversion,
c_args: common_cflags + drivers_cflags,
c_args: drivers_cflags,
include_directories: [
root_inc,
include_directories('nbis/include'),

View file

@ -10,9 +10,6 @@ project('libfprint', [ 'c', 'cpp' ],
gnome = import('gnome')
add_project_arguments([ '-D_GNU_SOURCE' ], language: 'c')
add_project_arguments([ '-DG_LOG_DOMAIN="libfprint"' ], language: 'c')
libfprint_conf = configuration_data()
cc = meson.get_compiler('c')
@ -23,8 +20,6 @@ glib_min_version = '2.56'
glib_version_def = 'GLIB_VERSION_@0@_@1@'.format(
glib_min_version.split('.')[0], glib_min_version.split('.')[1])
common_cflags = cc.get_supported_arguments([
'-fgnu89-inline',
'-std=gnu99',
'-Wall',
'-Wtype-limits',
'-Wundef',
@ -34,7 +29,15 @@ common_cflags = cc.get_supported_arguments([
'-Wshadow',
'-DGLIB_VERSION_MIN_REQUIRED=' + glib_version_def,
'-DGLIB_VERSION_MAX_ALLOWED=' + glib_version_def,
'-D_GNU_SOURCE',
'-DG_LOG_DOMAIN="libfprint"',
])
c_cflags = cc.get_supported_arguments([
'-fgnu89-inline',
'-std=gnu99',
])
add_project_arguments(common_cflags + c_cflags, language: 'c')
add_project_arguments(common_cflags, language: 'cpp')
# maintaining compatibility with the previous libtool versioning
# current = binary - interface