Difference between revisions of "CMake"

From AMule Project FAQ
Jump to: navigation, search
Line 148: Line 148:
compile UPnP code
compile UPnP code
= Advantages of cmake ==
= Advantages of cmake =
*Not only denoised build (disable with make VERBOSE=1), it has colored  
*Not only denoised build (disable with make VERBOSE=1), it has colored  
build with progress in %.
build with progress in %.

Revision as of 11:19, 14 January 2012


In late development phase of 2.3.1, Vollstrecker has again been pissed by our autotools-based build-system. After some time time of tryouts, he decided to give cmake a chance. For more information about this system look [[1]].

As 2.3.1 has been already in rc-phase, this has been delayed to a later time, which has come now.


The intentional idea behind this is to replace to autotools build-system. So for linux, solaris and everything out there, that still uses configure-scripts. It's not intended to replace the project-files for MSVC or anything like that. If it works for this, good. If not, no problem we have working stuff which is specialiced and well maintained.


Install cmake for your system

On Win or Mac, get your copy from [download page]. Most linux distros have it already in their package management, so get it from there.

Get cmake enabled source

Go to [[2]], here can get either complete tarballs (named amule-cmake-<svn-rev>), or patches for the source (named cmake-<date>).

If you got the tarball, extract it and enter the created dir.

If you decided for the patch, go into an already existing source-dir (almost every version that compiles should be fine), in there run:

patch -p1 < <downloaded-patch-file>

As development takes place in a git repo, svn-revision can't be detected properly, so you got to create a usable information by hand in the top-level dir of your amule source by running.

echo "<svn-rev> > .svn-revision


It's recommended to do an out of source-build (in-source works, too), so for the shortest test you just got to:

mkdir build cd build cmake ../ make (make install, DESTDIR= works)

Types of configuration


This is variant with which you can see the most informations. Just start the gui from your menu, or run cmake-gui from the dir you want to build in.

Enter the path to source and/or build dir into the text-fields in the upper area of the dialog-window and then press configure. Here you can choose if you want cmake to create projects for your preferred IDE, or just makefiles. After the first run, you can en-/disable options like you want, if done press configure again, and it will present you what has changed based on your decisions, so you can adjust a bit more, like you want. If finally done, press generate.

Interview mode

Go to the dir you want to build in, and run:

cmake -i <path-to-source>

cmake will now configure the source, and will ask you the options it knows of.

Commandline Arguments

This one is most like the old configure-scripts. Just go to the dir you want to build in, and run:

cmake <path-to-source>


After configuration, you can build the binaries, the way you always do, depending on the type of output you have chosen. So if you decided to create a project file for an IDE, open that one in there and start build-process.

If you've chosen "Makefile" go to the dir you want to build in (actually you should already be there) and run:



Again, this depends on the output you've chosen. For "Makefile" you can do like usual:

make install

If you don't have superuser-priv's, or just don't want to install to a alternative location, you can use:

make install DESTDIR=<location>

This will install everything into <location> as top-level dir.


Options are passed to the script with -D<option=value>. Options are meant to be named as near to the old options as possible, so -DPREFIX= sets prefix, but for the separate apps, It has been found more meaningful to call them BUILD, so -DBUILD_ALC=on (ON, on, TRUE, true, YES, yes and many more are good) is used to build alc, -DBUILD_MONOLITHIC=off excludes amule.

Options for "What is built"

Here is a short summary of options you can choose from, to select what you want to build (defaults in brackets)


compile aMuleLinkCreator GUI version


compile aMuleLinkCreator for console


compile aMule command line client


compile all parts of aMule


compile C aMule Statistics


compile aMule daemon version


don't compile aMule ed2k links handler


compile aMule file viewer for console


disable building of the monolithic aMule app


compile aMule plasma applet and engine


compile aMule remote GUI


compile aMule WebServer


compile aMule GUI Statistics


install xas XChat2 plugin

Options for "How is it built"


build debugging symbols into binaries Turning this off hasn't been tested, so most-likely it won't change anything.


compile with GeoIP IP2Country library


enable using mapped memory if supported


enable national language support


compile UPnP code

Advantages of cmake

  • Not only denoised build (disable with make VERBOSE=1), it has colored

build with progress in %.

  • Can create not just Makefiles, there are generators for real many IDEs

out there, so you can create projects for xCode, Visual Studio, kdevelop or what you like to use.

  • Automatic caching, so reconfiguring with other options is much faster

by default (k, it's needed to tweak some stuff, but it works)

  • One build-system for all platforms. (theoretically spkeaking)
  • No need of generating the build-system (so no autogen needed anymore, just checkout (for users that use the svn or an alternative repo out there) and start.

Temporary Disadvantages of cmake

By now, a change to config.h means, that almost everything is rebuilt. Many (almost all) compiler-defines have been moved from compiler-cmd to config.h. Next step would be, to split it to separate headers, but for now they are kept in one to let it still be buildable with autotools, so we can keep both systems in a transition to the new one (if accepted).

Testing status

By now it's tested on following systems:

  • Debian (all flavors worked)
  • Ubuntu (all flavors worked)
  • Windows (short test by Stu, needs some modifications to detect everything)