C++ project flags for *.pc.in file run by configure?
Michał Górny
mgorny at gentoo.org
Fri Nov 10 13:42:19 UTC 2017
Dnia 10 listopada 2017 13:38:59 CET, Jeffrey Walton <noloader at gmail.com> napisał(a):
>Hi Everyone,
>
>We are a C++ library. I'm trying to determine how to include CXXFLAGS
>in our *.pc.in file.
The answer is: you don't. "Cflags" are really misnamed CPPFLAGS, and that's how many projects use them.
>
>Most sample *.pc files that discuss the subject of configure
>generating a *.pc have:
>
> Cflags: ${@CFLAGS@} -I${includedir}
> Libs: -L${libdir} -lcryptopp
>
>My question is, what do we do for a C++ project? Should we use this:
>
> Cxxflags: ${@CXXFLAGS@} -I${includedir}
> Libs: -L${libdir} -lcryptopp
>
>Or maybe this:
>
> Cxxflags: ${@AM_FLAGS@ @CXXFLAGS@} -I${includedir}
> Libs: -L${libdir} -lcryptopp
>
>Or maybe something else?
All of these are wrong. You don't include user's *FLAGS, ever. Only the specific flags that you force via the build system and know to be safe.
>
>We can't risk using Cflags, where options like -std=c11 may be
>present. Building some packages, like Git, require both CFLAGS and
>CXXFLAGS due to dependent libraries like PCRE and PCRE2.
For completeness, -std settings don't really belong in pc files. If you require a specific standard, all library users need to enforce it. Otherwise, you're asking for huge trouble (e.g. think of using two libs, one forcing c++11, other c++14).
>
>My apologies for asking. The pkg-config(1) man page does not discuss
>it. I've tried searching the mailing list archives, but I am drowning
>in irrelevant noise.
>
>Jeff
>_______________________________________________
>pkg-config mailing list
>pkg-config at lists.freedesktop.org
>https://lists.freedesktop.org/mailman/listinfo/pkg-config
Hi,
--
Best regards,
Michał Górny (by phone)
More information about the pkg-config
mailing list