Install CMake using APT (again)

With the upcoming Bionic environment, could the locally installed CMake version be replaced by the use of the Kitware APT repository?


Currently (on Trusty and Xenial) CMake is installed in /usr/local/cmake-<version>/bin/cmake and overrides all other installations. This results in unexpected behaviour and complicates the use and install of a different CMake release.
On Travis you always have to call CMake with the exact path. (Or edit $PATH by removing the custom section.)

  • Installing/updating CMake using APT doesn’t have the expected effect, resulting in useless calls.
  • The official CMake installer from Kitware installs to /usr/local/bin. Expected behaviour is that it is preferred over the default version.
  • sudo cmake does not work without manually passing $PATH. Github travis-ci #9113


Kitware has an APT repository, currently supporting Ubuntu Xenial and Bionic with the latest release version:

  • Remove the locally installed CMake release.
  • Add the official Kitware APT repository to the safe-list.
    Preferably both the stable and release-candidate repository.
  • Install the (current) latest stable release from Kitware on the Bionic image.
    The Ubuntu default (v3.10.2) would probably be good for most, but it might cause issues for configurations expecting at least v3.12.4, as installed on Xenial.


  • Users can update to the latest release with sudo apt upgrade cmake.
  • Or the latest release candidate (if present) after adding the RC channel.
  • Apt installs to /usr/bin,
  • Locally installed versions are preferred, simplifying installation for testing with a different release.
    i.e. Everything works as on any other system.

Travis Build exploring the current situation