[CMake] pkg-config file format versus CMake packages
paul
pfultz2 at yahoo.com
Thu May 31 13:41:06 EDT 2018
On Thu, 2018-05-31 at 10:12 -0400, Brad King wrote:
> On 05/25/2018 07:52 PM, Paul Fultz II wrote:
> > What else is missing?
>
> The `.pc` format focuses on flat command-line strings that drop much
> of the information used to generate them. For example, if library
> A depends on library B then the `.pc` file will record the link flags
>
> -L/path/to/A/lib -L/path/to/B/lib -lA -lB
No, it would record it as:
Requires: B
It would only record it as `-L/path/to/A/lib -L/path/to/B/lib -lA -lB` if B
didnt support pkg-config. This same problem exists for cmake if the user
doesn't use a separate target for library B.
>
>
> Some CMake "find modules" try to extract information from `.pc` files
> by running pkg-config to get command lines. They inevitably have to
> parse the command lines and manually reconstruct things that could have
> been put in the packaging files in a structured way in the first place.
This is because cmake lacks native support for pkg-config. It only uses the
pkg-config CLI, which works fine for makefiles.
Instead cmake needs to make a target for each `.pc` found. This could be
possible if it used libpkgconf instead.
Even more so, we could support a `cmake_target` variable so .pc files could
specify the cmake target name.
>
> > extending pkg-config seems like it would help adoption rather then
> > creating a completely new format.
>
> It would be nice if that would work. However, most `.pc` files already
> leave out much of the deeper information CMake likes to have. Even
> if we found a good way to represent that information in `.pc` files
> projects would still need big updates to produce that information.
Projects would need to be updated for cps as well, but it seems a few tweaks
to pkg-config is more likely to be accepted than adding a new file format.
Paul
More information about the CMake
mailing list