Learn how to install the latest version of CMake on Ubuntu.
The version of CMake that I tried to install this time
If you want to install CMake most easily, you can install it with apt-get (RHEL system such as CentOS is yum) as follows.
$ sudo apt-get install cmake
However, the version of Cmake you get with this is somewhat older. (I think the version of cmake I checked was 3.10.) The only way to get the latest version (not just the latest version, but other versions as well) is to get it directly from the site.
You will need the OpenSSL development package to install CMake. It can be installed with the following command.
$ sudo apt-get install libssl-dev
You can check the version as follows.
$ dpkg -l | grep libssl ii libssl-dev:amd64 1.1.1-1ubuntu2.1~18.04.5 amd64 Secure Sockets Layer toolkit - development files
Looking at this, it seems that it is version 1.1.1. By the way, prior to this, OpneSSL itself was updated as follows.
$ sudo apt-get install openssl
After the installation is complete, check the version as follows.
user@hyasuda:~$ openssl version OpenSSL 1.1.1 11 Sep 2018
The source code of CMake can be obtained from the following site. https://cmake.org/download/
Here, I installed the latest version of CMake 3.17 at that time. Please note that make must be pre-installed before installation.
Download the source file (hogehoge.tar.gz) from the above site. What is the content of the file after downloading and unzipping it?
$ ls /path/to/cmake-3.17.2 Auxiliary CMakeLists.txt CTestCustom.cmake.in Help README.rst Utilities doxygen.config CMakeCPack.cmake CMakeLogo.gif CompileFlags.cmake Licenses Source bootstrap CMakeCPackOptions.cmake.in CONTRIBUTING.rst Copyright.txt Modules Templates cmake_uninstall.cmake.in CMakeGraphVizOptions.cmake CTestConfig.cmake DartConfig.cmake Packaging Tests configure
Just run bootstrap in it and then make. For more information, read the README.rst inside. (In fact, the content written here explains the contents of README.rst as it is)
$ cd /path/to/cmake-3.17.2 $ ./bootstrap && make && make install
This completes the installation. After all is completed, check the version with the cmake command.
$ cmake --version cmake version 3.17.2
When I tried it, it got stuck without the OpenSSL development package, but after that it worked fine. I would be grateful if you could let me know if you are stuck.