How to install a KDE4 Package from source with cmake

Posted on March 14th, 2008 in Commandline Tools, KDE by admin

KDE4 applications use CMake instead of autotools as build system. So the usual configure, make, make install that we’re used to will not work. Instead KDE4 uses Cmake. The KDE team decided the switch to Cmake because compilation time is much faster, mainly due to not using libtool anymore and the fact that build files are easier to write,

Many systems have cmake in the repositories, check there first. If you cannot find cmake in the repo’s of your distribution, you can build that from source as well. First download it from here: http://www.cmake.org/HTML/Download.html

and now lets build it from source as root.

$ mkdir cmake-build
$ cd cmake-build
$ ../bootstrap
$ make
$ make install

By default, this will install CMake in /usr/local, so make sure to have /usr/local/bin in your execute path. To change the installation prefix (e.g. to /usr in debian), add the ‘–prefix=PATH’ option to the bootstrap command.

You have to run CMake so that it generates the build files for your system. Both in-source and out-of-source builds are supported by CMake, but currently in-source builds are prevented by the KDE implementation.

So, let’s say you have kdelibs/ in ~/src/kdelibs/, then do the following:

$ ls
kdelibs/
$ mkdir kdelibs-build
$ cd kdelibs-build
$ cmake ../kdelibs

After cmake completes kdelibs for kde4 should be installed.

This will generate the Makefiles for building kdelibs/ in kdelibs-build/.

Post a comment