prev. article next article

replacing automake by cmake

28 Jan 2011


as i’ve been experimenting with nix [1] (cross platform, cross distribution package manager) i hit a lot of issues in the automake based buildsystem. this post is about what motivated me to replace automake with cmake. it also coveres issues i had to solve. the nix-0.16-cmake project can be found at [2].

found autotools issues

i’ve found quite many issues in the autotools build script of nix. i don’t know if they are specific to nix or to autotools. however: i don’t like autotools because:

in contrast cmake:

some may say i might a bit biased towards cmake, so let’s consider nix-specific issues only:

i might very likely hit some other issues but i don’t remember them. if this list is not enough for you, just read why the kde developers use cmake instead of autools/scons today.

NOTE: this is not a criticism about upstream (the nix developers). i do like their work very much. in case they do not want to use cmake, i’m fine with that. they can use my changelog to fix issues associated with the automake issues i pointed out.

how to replace autotools by cmake

one of the first things was to install nix 0.16 with autotools:

i copied the shell output to a text file to have an idea what to do when. next i started from scratch with a top-level ‘CMakeLists.txt’.

i’ve also created scripts to automate various installation scenarios for automated testing.

interesting findings

cmake pitfalls

the result of using the wrong PERMISSONS was:

CMake Error at scripts/cmake_install.cmake:40 (FILE): file INSTALL cannot set permissions on “/tmp/nix-cmake/bin/nix-collect-garbage” Call Stack (most recent call first): cmake_install.cmake:175 (INCLUDE)

current status

i’ve invested quite some time now and still the project isn’t finished. it’s usually very small issues as discussed in the pitfalls section already. since this is my first major cmake integration i expected this. see [5] for further details.