On 27/06/19 13:23, Markus Armbruster wrote: > Note that there's also glib dependency, which works the same (see > previous patch). With Make, we add GLib flags to QEMU_CFLAGS and LIBS, > so they get used for everything unless overridden.
Having to add glib everywhere is mildly annoying. We can avoid that once we convert libqemuutil.a to meson, via libqemuutil = static_library('qemuutil', ...) libqemuutil = declare_dependency(link_with: libqemuutil, dependencies: glib) >> +libiscsi = declare_dependency(compile_args: >> config_host['LIBISCSI_CFLAGS'].split(), >> + link_args: config_host['LIBISCSI_LIBS'].split()) > ... we define here. Less magical. A couple notes here. First, later on this declare_dependency() will be replaced by dependency(), so that meson itself will run pkg-config rather than our configure script. Second, some magic will reappear once we start using sourcesets[1], which allow dependencies will be attached to sources rather than executables. However, there will still be no need to track cflags and ldflags separately. It will look like this: # in block/meson.build block.add(when: libiscsi, if_true: files('iscsi.c')) # in toplevel meson.build block_obj = block.apply(config_host) executable('qemu-img', sources: ['qemu-img.c', block_obj.sources()], dependencies: [libqemutil, block_obj.dependencies()]) Paolo [1] https://mesonbuild.com/SourceSet-module.html