[cmake-developers] Improved support for using cmake-based libraries in non-cmake projects

Eric Noulard eric.noulard at gmail.com
Sun Jun 5 17:21:43 EDT 2011


2011/6/4 Alexander Neundorf <neundorf at kde.org>:
> Hi,
>
> KDE is getting more modular, so instead of a few huge "modules" there will be
> much more independent libraries.
> We'll try to make all those libraries install proper FooConfig.cmake files.
> Currently most of these libraries install already pkgconfig pc-files.
> This means they (would) have to install two such files, one for pkgconfig and
> one for cmake.
>
> Proposal: I'd like to add a command line switch to cmake, so you can call it
> like
> cmake --find_package Foo --Dmode=COMPILE --Dtoolchain=GNU
> and it will
> * try to find Foo only in config-mode
> * if found, it will check that it has been found via FOO_FOUND
> * if so, it will check that for FOO_INCLUDES and FOO_LIBRARIES
> * create the command line arguments for the compiler from that
> * print "-I/opt/foo/include" to stdout
>
> This would make these installed Config-files usefull also for non-cmake,
> simple Makefile-based projects.
>
> Opinions ?
> I think I'll start working on this in the next days.

I think that adding more and more command line options to the "cmake" command
may make it bloated.

Wouldn't be possible to add separate cmake scripts to the cmake distribution
with simplified command line args which e.g.

cmake-config --cflags Foo
which would transparently call some cmake scripts like that
cmake --Dmode=COMPILE  -Dmodule=Foo -P cmake-config-script.cmake

cmake-config --ldflags Foo
would translate to
cmake --Dmode=LINK  -Dmodule=Foo -P cmake-config-script.cmake

that way you may implement your idea using a "simple" CMake script
+ a wrapper executable/scripts.

and the cmake command line API remains as it is today.


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the cmake-developers mailing list