[Qgis-developer] CMake for building QGIS?

Mateusz Loskot mateusz at loskot.net
Thu Sep 7 14:20:39 EDT 2006


Martin Dobias wrote:
> On 9/7/06, Mateusz Loskot <mateusz at loskot.net> wrote:
>> Martin Dobias wrote:
>> > Some time ago I've read about CMake build system and that KDE
>> > developers have switched from autotools to it for KDE4. I've tried it
>> > a bit and it looks very promising. This is a good reading for those
>> > who don't know anything about it:
>> > [1] http://lwn.net/Articles/188693/
>> > [2] http://www.linuxjournal.com/article/6700
>> >
>> > On page [1] you can find pros and cons of this system and advantages
>> > that developers of Scribus project see in it. It should suit our needs
>> > well as it has good support for different platforms and also it's
>> > really easy to use in comparison with autotools. I've already managed
>> > to compile with it QGIS core library on linux.
>> >
>> > What are your opinions about such switch for the next version of QGIS?
>> > I could try to prepare the build system in the refactoring branch to
>> > see if it works well.
>>
>> I started to like cmake, it's easier to write makefiles
>> and Visual C++/KDevelop workspaces generation sounds promising.
>> However, I still does not have any idea how to achieve something
>> like dynamic configuration similar to ./configure scripts.
>> IMHO, cmake is still under development and I'm not sure if it's
>> very mature.
>>
>> I'd also like to hear more cmake pros and cons.
> 
> The best pros are that CMake's files are much easy to read and write
> than those autoconf macros, configuration takes much less time,
> generated makefiles are smaller, has graphical  configuration (resp.
> curses for unixes), Qt4 is supported out of the box. Also the choice
> to use it for next KDE means that it's quite mature and will be well
> supported in future.

Indeed, simplicity is one of cmake's advantage.
I'd add one more, that in comparison to autotools builds,
cmake makes it extremely simple to keep all build configuration,
build files out of the source tree.
For example

project/src - includes poor .h and .cpp files
project/build - includes CMakeLists.txt + all generated stuff
like Makefiles etc.

I like clean source trees and cmake help to keep them as such :-)

Another advantage is that creating new macros, m4 and autoconf
equivalents, is very simple.

> I see cons just in the need of learning a new language and that so far
> not many people are used to it.

Right.

>> BTW, recently one of GEOS user posted cmake for GEOS.
>> I tunned it a bit and, as I said, I started to like cmake ;-)
>> http://geos.refractions.net/pipermail/geos-devel/2006-September/thread.html
>>
> 
> From the contributed cmake it's possible to see how simple can a build
> system be. Quantum GIS in addition needs just some 3rd party detection
> for Qt4, GDAL, GEOS, Proj4 and GSL, but I don't think it will be hard
> to create them.

It should be, see "How to write a FindFoo.cmake module"
section on following wiki:

http://www.cmake.org/Wiki/CMake_HowToFindInstalledSoftware

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Qgis-developer mailing list