From 1579a87b3b81244fe56b63d1e51f7d2b068f0757 Mon Sep 17 00:00:00 2001
From: Xavier Claessens The most important pkg-config metadata fields are
- Requires, Requires.private, Cflags, Libs
- and Libs.private. They will define the metadata used by external
- projects to compile and link with the library. Requires and Requires.private define other modules
- needed by the library. It is usually preferred to use the private variant of
- Requires to avoid exposing unnecessary libraries to the program
- that is linking with your library. If the program will not be using the
- symbols of the required library, it should not be linking directly to that
- library. See the discussion of
+ Requires, Requires.private, Requires.internal,
+ Cflags, Libs and Libs.private. They will define
+ the metadata used by external projects to compile and link with the library. Requires, Requires.private and Requires.internal
+ define other modules needed by the library. It is usually preferred to use the
+ private variant of Requires to avoid exposing unnecessary libraries
+ to the program that is linking with your library. If the program will not be
+ using the symbols of the required library, it should not be linking directly
+ to that library. See the discussion of
overlinking
for a more thorough explanation. Since pkg-config always exposes the link flags of the
Requires libraries, these modules will become direct dependencies
of the program. On the other hand, libraries from Requires.private
- will only be included when static linking. For this reason, it is usually
- only appropriate to add modules from the same package in Requires.
-
The Libs field contains the link flags necessary to use that library. In addition, Libs and Libs.private contain link @@ -404,10 +414,10 @@ myapp_LDADD = $(X_LIBS) expose libx data types in its public API. What do I put in my z.pc file? -
Again, add the module to Requires.private if it supports - pkg-config. In this case, the compiler flags will be emitted - unnecessarily, but it ensures that the linker flags will be present when - linking statically. If libx does not support pkg-config, +
Add the module to Requires.internal if it supports + pkg-config. Unlike Requires.private the compiler flags + will not be emitted, but it ensures that the linker flags will be present + when linking statically. If libx does not support pkg-config, add the necessary linker flags to Libs.private.
-- 2.14.1