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

Alexander Neundorf neundorf at kde.org
Sun Jun 5 18:48:58 EDT 2011


On Sunday, June 05, 2011 11:21:43 PM Eric Noulard wrote:
> 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

You mean "separate scipts", not "separate cmake scripts", right ?
Under Unix this could be shell scripts, under Windows probably batch files.
I don't know what the other cmake developers think of this.

Under Unix it would also be possible to create a symlink "cmake-config" to 
cmake and check for that. But that also doesn't work under Windows AFAIK :-/

Alex



More information about the cmake-developers mailing list