There are four ways to get the current version, or at least a new-enough version, of CMake installed on your system. Which of these can be used depends on your target system.
- Install CMake from your system's distribution repositories
- If your distro came with a pre-3.4 CMake, see if a newer version has been backported.
- Install binaries from https://cmake.org/download
- Build from source, also at https://cmake.org/download
Note: use https://cmake.org/files for direct links to older versions of CMake.
Here are quick links to information for each target system. There are some considerations for building CMake from source, whether using the CMake bootstrap process or building using a previously-installed version of CMake to configure the build.
Linux
There are four ways to get CMake installed on your system.
- Install CMake from your system's distribution repositories
- If your distro came with a pre-3.4 CMake, see if a newer version has been backported.
- Install binaries from https://cmake.org/download
- Build from source, also at https://cmake.org/download
Procedures for using options one or two are dependent on your target system's distribution and release.
Installing Pre-Built Binaries
Pre-built binaries can be downloaded for 64-bit systems,
and for 32-bit systems up to CMake 3.6.3.
The tarball for binaries includes
bin, doc, man, and share directories
and may be installed under any parent directory.
All four directories must be installed under the same parent directory.
For example,
if one installs the Linux binaries in $HOME/cmake
,
one can invoke CMake for the configure step using:
$HOME/cmake/bin/cmake
and that binary will be used for the build and install steps.
(ctest and cpack will need to be run using
$HOME/cmake/bin/ctest and $HOME/cmake/bin/cpackinstall,
respectively).
This author has tested the pre-built 64-bit Linux binaries for CMake 3.10 on:
- CentOS7
- Debian 9 and 8
- Open SUSE Leap 42.3
- Ubuntu 17.04 , 16.04.3 LTS, 14.04.5 LTS
- Windows Subsystem for Linux (Ubuntu 16.04.3 LTS, Windows Fall 2017 Creator's Update)
This author has tested the pre-built 32-bit Linux binaries for CMake 3.6.3, the last CMake release with 32-bit Linux binaries, on:
- Debian 9-32 (Stretch)
- Debian 8-32 (Jessie)
- Ubuntu 16.04.3 LTS
Build From Source on Linux
See Build From Source. There are no special considerations for building from source on Linux.
Windows
Here are your choices:
Install CMake from your system's distribution repositoriesIf your distro came with a pre-3.4 CMake, see if a newer version has been backported- Install binaries from https://cmake.org/download
Build from source, also at https://cmake.org/download.
That is it. Hobson's choice: binaries or nothing (more about Hobson's choice). But the binaries are a good choice, and much better than giving up. Pick the most recent version.
If your Windows system has a pre-3.5 version of CMake already installed, you must uninstall it before installing version 3.5 or newer due to a change in the installer technology. Uninstalling an older version is not a problem; CMake does not have settings that would be removed by an uninstall.
If you find that the most recent version does not work, uninstall that one and install an older version. You can find older versions at: https://cmake.org/files/. Just do not install one older than 3.4.0.
One can build CMake from source on Windows, one just has to install CMake using binaries to do this. There is no equivalent to the bootstrap process available on other target systems. Because Windows binaries are available for all CMake releases, there does not seem to be a need to build from source. Unless, of course, you wish to become a CMake developer.
Mac OS X / macOS
See if CMake is included in the macOS app store, and if so, how. But it is not likely to be there; web search results showed lots of examples of using homebrew to build from source or using the binaries for macOS X 10.6 (Snow Leopard) or better.
Here are your choices:
Install CMake from your system's distribution repositoriesIf your distro came with a pre-3.4 CMake, see if a newer version has been backported- Install binaries from https://cmake.org/download. This option is available for macOS 10.6 (Snow Leopard) or newer only.
- Build from source, also at https://cmake.org/download.
Build From Source on macOS
See Build From Source. In addition, you will need the macOS application Homebrew and/or the Xcode command line utilities. This author does not have access to a Mac, so this procedure has not been validated. Any feedback about building from source under macOS would be welcomed.
Other UNIX-like Systems
There are three ways to get CMake installed on your system.
- Install CMake from your system's distribution repositories
- If your distro came with a pre-3.4 CMake, see if a newer version has been backported.
Install binaries from https://cmake.org/download- Build from source, also at https://cmake.org/download
Procedures for using options one or two are dependent on your target system's distribution and release.
Build From Source on FreeBSD
See Build From Source.
CMake versions 3.6.0 and newer can be built
from source on FreeBSD 11 without needing
--system-curl
when using bootstrap
or
-DCMAKE-USE-SYSTEM-CURL
when building
using an older version of CMake.
This is likely to be true on newer versions of FreeBSD,
and it may be true for older versions as well.
If you try building from source on a newer or older FreeBSD version, please provide feedback about your experiences.
Note that Ninja is not supported as a Hercules build tool on FreeBSD. This restriction will be removed if and when SoftFloat-3a For Hercules is built as a shared library. This restriction applies whether CMake is built from source or installed from a FreeBSD package or ports repository.
Build From Source
Complete "build from source" instructions may be found on the CMake web site at https://cmake.org/install/. Review those instructions and come back here for additional important information.
CMake uses CMake to configure CMake and create build scripts used when
building CMake from source.
If the target system does not already have an older CMake installed,
CMake sources include a bootstrap
shell script that first builds a
fixed configuration "bootstrap" CMake from source and then uses that
bootstrap CMake to build the "real" CMake.
The bootstrap process is not available on Windows systems,
nor is it needed because CMake provides installable binaries for all
versions of CMake.
The published CMake build from source process builds in the source directory and uses no options. If you are building a version older than 3.7.1, or on a system with OpenSSL older that 1.1, take note of the following:
CMake Version | OpenSSL 1.1 | OpenSSL 1.0 |
---|---|---|
3.7.1 or newer | No issues |
Use Have the curl (OpenSSL flavor) and zlib development headers and libraries available on the target system. Avoid the GnuTLS curl development headers and library. Note: Above options not required if building on FreeBSD 11 or newer, and may not be required on older versions of FreeBSD. |
3.5.0 to 3.7.0 |
Use Have the libarchive and liblzma development headers and libraries installed on your system. For the technical details, please see CMake issue 16459 and CMake merge request 289. |
|
3.4.0 to 3.5.3 |
Use Have the curl (OpenSSL flavor) and Zlib development headers and libraries available on the target system. Avoid the GnuTLS curl development headers and library. |
|
Older than 3.4.0 | Not supported to build Hercules | |
The above options are required to enable HTTPS protocol support
in the CMake file( DOWNLOAD url ) command.
The CMake build for Hercules uses https transfers to compare the
versions of BZip2 and Zlib on the target system with those available
in the Hercules-390 repository.
|
You may find some of the available options for the bootstrap
procedure helpful;
find them using ./bootstrap --help
.
CMake is not bootstrapped when using --help
.
If you are using a prior version of CMake to build from source,
you can use cmake-gui
to review available
options.
Here are some suggestions:
- Build out of source.
The
bootstrap
command supports this; just execute it from the build directory. For example:
../cmake-3-.10-0/bootstrap
-
Use the
--parallel=n
option, where n is the number of parallel build tasks. The value is not limited by the number of processors available; memory is the primary limit. The bootstrap process seems to need about 3GB of memory when using--parallel=10
. -
Consider using
--prefix=<install-prefix>
to install CMake in other than the default, which is normally/usr/local/bin
. CMake can be run from other than the default installation directory without complications. For example: If one installs the Linux binaries in $HOME/cmake, one can invoke CMake for the configure step using $HOME/cmake/bin/cmake, and that binary will be used for the build and install steps. (ctest and cpack will need to be run using $HOME/cmake/bin/ctest and $HOME/cmake/bin/cpackinstall, respectively).
This web page Copyright © 2018 by Stephen R. Orso.
This work is licensed under the Creative Commons Attribution-
ShareAlike 4.0 International License.
To view a copy of this license,
visit
http://creativecommons.org/licenses/by-sa/4.0/
or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.