Upgrading CMake for a Happier Swift Build

swift-og

There have been a number of updates to Open Source Swift that take advantage of newer versions of CMake to build swift on Linux. In particular, the default version of cmake that comes with Ubuntu 14.04 (2.8.12.2) is no longer up to the task.

Let’s get our Ubuntu 14.04 environment updated with CMake 3.4.3, the version proposed by the developers that work in this area.

On systems I’m installing software by source, I usually have a build area in /usr/local/src and an area of archives (so I can keep track of the versions I built) in /usr/local/archive:

As root or using sudo:

# cd /usr/local/archive
# wget https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz
# cd ../src/
# tar -xzvf ../archive/cmake-3.4.3.tar.gz

Now, to configure and build:

# cd cmake-3.4.3
# ./configure --prefix=/usr/local
...
CMake has bootstrapped.  Now run make.
# make

Finally, make install will install cmake and its associated configuration to /usr/local.

# make install
# which cmake
# cmake --version
cmake version 3.4.3

CMake suite maintained and supported by Kitware (kitware.com/cmake).

That’s all it takes. Happy building!

Leave a Reply

Your email address will not be published. Required fields are marked *