pkg-config --cflags returns cflags from Requires.private
Submitted by Xavier Claessens
Assigned to pkg..@..op.org
For example, libsoup-2.4.pc has Requires.private libxml2
$ pkg-config --cflags libsoup-2.4 returns "-I/usr/include/libxml2"
$ pkg-config --libs libsoup2.4 does not include -lxml2
$ pkg-config --libs --static libsoup2.4 does include -lxml2
That means that if I'm compiling an app that uses libsoup I have to install header files for libxml2 even if I don't use them. There is currently no way to tell in a .pc file that libfoo needs libbar when static linking but does not exposes libbar into its API.
This behaviour seems intentional from that commit  for bug .
If I understand correctly the reason is to support case where libfoo exposes libbar in its API but does not need to link to it. So there are 2 valid use cases but only one of them is possible to express. There is a long discussion about this in a Meson issue.
- Keep Requires.private behaviour unchanged, for backward compatibility. Consider it deprecated.
- Add Requires.cflags to mean only pull cflags from those deps, not libs. Maybe pull their libs with --static?
- Add Requires.private-libs to mean only pull libs from those deps when with --static.
 https://cgit.freedesktop.org/pkg-config/commit/pkg.c?id=0936824bf02c604457147af1858ae6f5b504155f  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340904  https://github.com/mesonbuild/meson/pull/3251