Append a dependency's cflags with meson-build

Viewed 42

I have a project that uses meson-build as a build system. The project dependencies are provided via the conan package manager in the form of package-config files. I struggle to append custom cflags to the dependencies.

Consider the following example. My project depends on poco. I use conan to manage this dependency and to create the .pc file:

prefix=/home/user/.conan/data/poco/1.12.1/_/_/package/4c07c9d602a0b548ed49892e5375a64ff54db11d
libdir=${prefix}/lib
includedir=${prefix}/include

Name: poco-poco_foundation
Description: Conan package: poco-poco_foundation
Version: 1.12.1
Libs: -L"${libdir}" -lPocoFoundation  -lpthread  -ldl  -lrt  -Wl,-rpath,"${libdir}"
Cflags: -I"${includedir}" -DPOCO_STATIC=ON -DPOCO_UNBUNDLED
Requires: libpcre2 zlib

I add this dependency to my build using the following line in meson.build file:

poco_foundation_dep = dependency('poco_foundation')

This works as intended. However, I would like to suppress a warning on this dependency by adding -Wno-sign-compare to the cflags. I fail to find a way to do this.

In my mind, I would like to do

poco_foundation_dep.cflags += -Wno-sign-compare

Please note that I don't want to modify the .pc files created by conan since they are automatically generated.

0 Answers
Related