Upgrading Cmake on Ubuntu 14.04 (Trusty Tahr)

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
User avatar
Gaiha
Gnoblar
Posts: 24
Joined: Thu Feb 04, 2016 7:05 pm
Location: Canada
Contact:

Upgrading Cmake on Ubuntu 14.04 (Trusty Tahr)

Post by Gaiha » Tue Feb 09, 2016 12:30 am

If you're like me, I like to have the latest and greatest at my disposal, but sadly, the package repositories are not always up to date. So...

This Tutorial is presented to assist you to install/upgrade your existing Cmake installation to the latest release from Kitware. If you have an existing Cmake installation, you can simply use these simple steps to overwrite the installation directory from the binaries. ~Note~ The Ubuntu Pakages have Version 2.8 which is rather out of date to say the least.

Get the Newest Version:
Download the Distribution File directly from the KitwareWebsite, then extract the archive into your download folder.

From a Terminal, execute the following commands:
username@hostname:~S sudo su
[sudo] password for [hostname]:
# apt-get update
# apt-get dist-upgrade
# cd /Downloads
/Downloads# wget https://cmake.org/files/v3.5/cmake-3.5.0-rc1.tar.gz
/Downloads# tar xzf cmake-3.5.0-rc1.tar.gz
/Downloads# cd cmake-3.5.0-rc1
/Downloads/cmake-3.5.0-rc1#
Preparation:
Rename the existing installation directory to the new version where, "x.x" is the existing installation directory and "3.5" will be the new name. We will also want to install a compiler (if you haven't already done so) and a few other tools.

From a Terminal, execute the following commands:
# mv /usr/share/cmake-x.x /usr/share/cmake-3.5
# apt-get install build-essential checkinstall
# apt-get install cvs subversion git-core mercurial
Additional Options:
It is good practice to compile and install new software separate from your O/S, in case an installation fails because you are missing any dependencies. You should then build a common directory where you will be building these packages and prepare them for installation. You also want to make sure where you want to do this, is read/write/executable for the primary account user.

From a Terminal, execute the following commands:
# sudo chown $USER /usr/local/src
# sudo chmod u+rwx /usr/local/src
Configuration:
In order to being configuration, we need to instruct the install script, what to do and where to do it. In this case, we are instructing the installtion script to initiate the configuration in the directory you just renamed.

From a Terminal, execute the following command:
# ./configure --prefix=/usr/share/cmake-3.5
*this takes a few minutes.*

Compilation:
The previous command will bootstrap all the files within the cmake source directory and builds them so that they can be compiled.

From a Terminal, execute the following command:
# make
Installation:
You are now ready to finish things off by installing.

From a Terminal, execute the following command:
# make install
Verification:
After installation, without any errors, you can verify the installation.

From a Terminal, execute the following command:
# /usr/share/cmake-3.5/bin/cmake -version
This should display an output that resembles:
cmake version 3.5.0-rc1
Cmake suite maintained and supported by Kitware (kitware.com/cmake)
**DONE!**
0 x
I may not be perfect... but parts of me are Excellent!

Post Reply