pkgconf/pkgconf — pull request #50 by tonytheodore (2013-08-14 05:58:49+00:00)
Title: Feature Request: Add Cflags.private fragment

Hi,

This is [copied from the freedesktop request](https://bugs.freedesktop.org/show_bug.cgi?id=47996).

The Libs.private setting is a very handy way to handle static as well as shared library builds.

However, when (cross-)compiling for the Windows platform, this is not always sufficient. The libraries need extra "dllexport" declarations in the headers when building a shared library. Those can usually be suppressed (for static linking) by something like -DTHISLIBRARY_STATIC. It would avoid lots of nasty code if "pkg-config --cflags --static" could take care of that. It might be as simple as:

Cflags.private: -DTHISLIBRARY_STATIC

These changes are a naive implementation of the required behaviour - it basically mimics that of Libs.private.

```sh
pkgconf --cflags baz
-fPIC -I/usr/include/foo

pkgconf --cflags --static baz
-fPIC -I/usr/include/foo -DFOO_STATIC
```

I understand there is a [spec in progress](http://dev.gentoo.org/~mgorny/pkg-config-spec.html), but this functionality would be very handy at the moment.

Thanks,

Tony