Due to a developer request I needed to install the latest cmake 3.4.1 on an Ubuntu 14.04 LTS, however in trusty the cmake version is somewhat outdated (2.8.12) and there are no newer version in trusty-backports either.
On Ubuntu PPA I found a personal repository from Nathan Osman for cmake 3.x packages which sounds about the right source. Unfortunately this PPA does not contain the 3.4.1 version yet, so I had to go and compile cmake myself.
Compiling of cmake is pretty straight forward:
tar -xvzf cmake-3.4.1.tar.gz
Make's install command installs cmake by default in /usr/local/bin/cmake, shared files are installed into /usr/local/share/cmake-3.4.
sudo make install
Now I wanted to tell Ubuntu that the cmake command is now being replaced by an alternative installation. This can be done using update-alternatives:
update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force
This tells Ubuntu to create a new alternative for /usr/bin/cmake by using /usr/local/bin/cmake. The name of this replacement/alternative is "cmake". In my case I needed to add --force because cmake was already installed and the /usr/bin/cmake binary wasn't replaced with the symlink otherwise.
Now cmake is available system wide and can be launched with the new 3.4.1 version:
cmake version 3.4.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).