[cmake-developers] pkg-config like mode for cmake ?

Eric Noulard eric.noulard at gmail.com
Fri Mar 12 15:47:40 EST 2010

2010/3/12 Alexander Neundorf <neundorf at kde.org>:
> Hi,
> when discussing with Marcus, we had an idea.
> Since 2.6.0 cmake can install FooConfig.cmake export files to help with
> finding installed software via the find_package() command.
> This is very nice and useful as long as you are using cmake yourself for your
> project. If you are using something else, e.g. plain Makefiles (or autotools
> or whatever), these installed export-files are more or less unusable for you.
> Some cmake projects additionally install pkgconfig pc-files, but then you rely
> on pkg-config, which IMO sucks.
> How about doing it just vice versa ?
> Instead of installing pc-files, add a mode to cmake so it acts pkgconfig-like,
> i.e. it searches for the package and prints the required compiler flags to
> stdout ?
> Like
> $ cmake --findpackage Foo --libs
> would basically execute a
> find_package(Foo NO_MODULE)
> then see which imported libraries have been executed, and then print the
> linker flags to link these libraries.
> For the include dirs one would have to rely on these variables named properly
> this order.
> What do you think ?

Very nice idea
+1 on my side.

However the cross platform nature of CMake would make me think that
something like:

cmake -G<GeneratorName> --findpackage Foo --libs
may be better.

Because I think that the "linker flags" output may well depend on the
platform/compiler combination, or am I wrong?
Membre de l'April - « promouvoir et défendre le logiciel libre » -

More information about the cmake-developers mailing list