introduce pkg-config files

Alexander Neundorf neundorf at kde.org
Mon Oct 25 21:49:13 CEST 2010


On Friday 22 October 2010, Pavol Rusnak wrote:
> Hi all!
>
> Today I spoke with some KDE folks at the openSUSE Conference and we came
> to the conclusion that it would be great if all packages where it makes
> sense (mainly libraries) started to use pkg-config files. If they were

What do you mean with "use pkg-config files" ?
Use pkg-config to find other software or install pkg-config files for 
themselves ?

For using pkg-config to find other software:
KDE uses cmake for building, and cmake is able to find software without the 
help of pkg-config. It is also a requirement for any Find-module in KDE that 
it can find the repsective software without the help of pkg-config.
This is a simple thing to do, you just need 
find_program/find_library/find_path() calls and set CMAKE_PREFIX_PATH 
accordingly.
Relying on pkg-config would mean that for building KDE or some other package, 
you need to set at least two environment variables: CMAKE_PREFIX_PATH and the 
pkg-config variable.
So, to make it short: using pkg-config in KDE's Find-modules is ok, but they 
*must* also work without pkg-config, as long as the package is installed in a 
standard location or CMAKE_PREFIX_PATH is set correctly.
Also, our Windows-developers like the fact that we don't rely on pkg-config.


For installing pkg-config files for KDE modules which install libraries:
I don't have objections, but I also don't see a big benefit.
Some of the KDE modules which install libraries (kdelibs, kdepimlibs, and some 
others) already install CMake Config.cmake files. These files are 
cmake-script files, which are searched and loaded by cmake when you do a 
find_package(Foo),
then it tries to find a FooConfig.cmake e.g. in libdir/cmake/Foo/.
These files are *much* more powerful than pkg-config files and can contain 
much more information.
E.g. they can provide full dependency information, support for different 
configurations (e.g. a debug and a release build etc.), full versioning (i.e. 
installing multiple versions and find_package() will find a suitable one if 
installed), etc.
So, while I don't have objections to installing pkg-config files, I don't see 
a big benefit in it, while I see major benefits with installing cmake 
Config.cmake files.

Who should be the users of these files ?
Other KDE applications or libs are best served with cmake's Config.cmake 
files.

> in-place we would be able to create cross-distro packages with ease and
> even to easily detect build requirements and autogenerate packages as well.

Can you please elaborate ?

If you install cmake 2.8.3 (currently in rc-phase), you also get a file 
FindPackageLog.txt, which lists all packages which were searched using
find_package() with the required version and whether they were found or not.

Alex


More information about the Kde-buildsystem mailing list