Meaning of "cflags"

Daniel Macks dmacks at
Sat Feb 9 14:27:30 PST 2008

I'm a bit confused by what pkg-config means by "cflags", specifically,
whether it means "flags for the c-language compiler, all stages" or
"flags for the precompiler, all languages". That is, is the Cflags
field supposed to contain flags for linking as well, or only flags for
source compiling (e.g., .c -> .o)?

In standard autotools usage, the *_CFLAGS variables are used both for
compiling and for linking, but are only used for compiling if the
language is C (*_CXXFLAGS is used instead of the language is C++).
Conversely, *_CPPFLAGS is used for compiling source of *any* language
into .o, but then not for linking. The latter seems to be how .pc
files expect the Cflags field to be used: they have data for libraries
that are used from C++ (not just C) and I've never seen linker flags
in Cflags (they go in Libs).

More information about the pkg-config mailing list