pkg-config/check/check-cflags-private
Oneric bb8f1b7b91 Add Cflags.private field
Those Cflags will be added if linking statically against a library;
this is necessary if the public headers need to be mutated depending on
linkage mode. Eg on Microsoft Windows varaibles whose definition resides
in a shared library need to be declared with a special attribute;
if linked to statically this attribute must not be used.

With Cflags.private their headers can eg check if 'LIBRARYNAME_STATIC'
is not defined to know that the special attribute is needed; without it
everyone linking against the library will need to manually research what
the expected macro is and set it depending on linkage mode.

This field is also supported by pkgconf since version 0.9.3 and
already used by (some) affected libraries targeting Microsoft Windows.

Note that _do_parse_cflags always adds the flags to pkg->cflags
and there is no pkg->cflags_private; instead the call to
parse_cflags_private is conditional. This matches the
existing implementation of Libs.private.

Closes: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/38
2021-09-30 19:02:01 +02:00

11 lines
176 B
Bash
Executable file

#! /bin/sh
set -e
. ${srcdir}/common
RESULT="-I/dummy/include"
run_test --cflags private-cflags
RESULT="-DDUMMY_STATIC=1 $RESULT"
run_test --static --cflags private-cflags