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

Eric Noulard eric.noulard at gmail.com
Sun Jun 5 19:14:07 EDT 2011


2011/6/6 Alexander Neundorf <neundorf at kde.org>:
> 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 ?

Both.
cmake-config would be a [portable] script (or even minimalistic
binary), which basically call
a cmake script (for portability).

> 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 :-/

Yes I know, on windows I bet you can install the same binary/script with
differents names (instead of symlinking) and the script/binary could check its
name in order know what to do this is what busybox do.

This would generate a possibly small waste of disk space on Windows.
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the cmake-developers mailing list