- Installing CMake
- Windows
- macOS
- Linux, UNIX
- Download Verification
- How to Install CMake on Debian 11
- Method 1: Installing CMake Using Software Center (GUI)
- Method 2: Installing CMake Using Tar.gz Archive (Command Line)
- Step 1: Download CMake
- Step 2: Extract CMake and Run the Bootstrap
- Step 3: Install CMake
- Step 4: Verify Installation
- Uninstall CMake
- Conclusion
- About the author
- Karim Buzdar
- How To Install CMake On Ubuntu And Debian
- Tutorial Install CMake On Ubuntu And Debian
- How to install CMake on Ubuntu
- How to install CMake through UI
- How to install CMake through the Ubuntu Command Line
- How To uninstall CMake Using The Ubuntu Software
- How to install CMake on Debian
- Enabled snaps on Debian and install CMake
- Conclusion
Installing CMake
There are several ways to install CMake, depending on your platform.
Windows
There are pre-compiled binaries available on the Download page for Windows as MSI packages and ZIP files. The Windows installer has an option to modify the system PATH environment variable. If that is not selected during installation, one may manually add the install directory (e.g. C:\Program Files\CMake\bin) to the PATH in a command prompt.
One may alternatively download and build CMake from source. The Download page also provides source releases. In order to build CMake from a source tree on Windows, you must first install the latest binary version of CMake because it is used for building the source tree. Once the binary is installed, run it on CMake as you would any other project. Typically this means selecting CMake as the Source directory and then selecting a binary directory for the resulting executables.
macOS
There are pre-compiled binaries available on the Download page for macOS as disk images and tarballs. After copying CMake.app into /Applications (or a custom location), run it and follow the “How to Install For Command Line Use” menu item for instructions to make the command-line tools (e.g. cmake) available in the PATH. Or, one may manually add the install directory (e.g. /Applications/CMake.app/Contents/bin) to the PATH.
One may alternatively download and build CMake from source as in the following section.
Linux, UNIX
There are pre-compiled binaries available on the Download page for some UNIX platforms. One may alternatively download and build CMake from source. The Download page provides source releases. There are two possible approaches for building CMake from a source tree. If there is no existing CMake installation, a bootstrap script is provided:
./bootstrap make make install
(Note: the make install step is optional, cmake will run from the build directory.)
By default bootstrap will build CMake without any debug or optimization flags. To enable optimizations you will need to specify the CMAKE_BUILD_TYPE option to bootstrap like this: ./bootstrap — -DCMAKE_BUILD_TYPE:STRING=Release
For more options with bootstrap, run ./bootstrap —help .
Or, an existing CMake installation can be used to build a new version:
(Note: the make install step is optional, cmake will run from the build directory.) If you are not using the GNU C++ compiler, you need to tell the bootstrap script (or cmake) which compiler you want to use. This is done by setting the environment variables CC and CXX before running it. For example:
env CC=cc CXX=CC ./bootstrap make make install
Download Verification
Each release on the Download page comes with a file named cmake-$version-SHA-256.txt, where $version is the release version number.
One may use this file to verify other downloads, such as the source tarball. For example:
$ curl -OL https://github.com/Kitware/CMake/releases/download/v3.20.1/cmake-3.20.1-SHA-256.txt $ curl -OL https://github.com/Kitware/CMake/releases/download/v3.20.1/cmake-3.20.1.tar.gz $ sha256sum -c --ignore-missing cmake-3.20.1-SHA-256.txt cmake-3.20.1.tar.gz: OK
The SHA-256 file itself can be verified by GPG signature:
$ curl -OL https://github.com/Kitware/CMake/releases/download/v3.20.1/cmake-3.20.1-SHA-256.txt.asc $ gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys C6C265324BBEBDC350B513D02D2CEF1034921684 $ gpg --verify cmake-3.20.1-SHA-256.txt.asc cmake-3.20.1-SHA-256.txt
The GPG key C6C265324BBEBDC350B513D02D2CEF1034921684 is a signing subkey whose expiry is updated yearly.
How to Install CMake on Debian 11
CMake is a free and easily available open-source tool that manages the build process in an OS. It is important to note that CMake does not build any software; it just helps in the building process. It is the compiler-independent method used to generate the build files for different build systems. CMake is a tool created by Kitware for a much more powerful environment that is used as an open-source project like VTK, ITK, etc.
In this post, you will learn how to install CMake on Debian 11 using the following ways:
Prerequisites:
To install CMake on Debian 11, users must have sudo rights.
Method 1: Installing CMake Using Software Center (GUI)
In this GUI method, we will install CMake from Debian Software Center. Complete the following steps in order to install CMake on Debian:
To begin the installation, open the Software Center in your system from the applications menu. Look for CMake application using the search button.
Once the application icon appears in the search result, click it to open the following window. Now, click Install to begin the installation of CMake on your Debian system.
Then, provide your password for authentication. After that, it begins the installation. Once CMake is installed, you will see the following window:
Method 2: Installing CMake Using Tar.gz Archive (Command Line)
In this method, we will install the latest version of CMake using the command line. Complete the following steps in order to install CMake on Debian:
Step 1: Download CMake
As the official repository of Debian does not include CMake, we will use the tar.gz package available at the CMake official site.
Launch the terminal utility using the Ctl+Alt+T keyboard shortcut in your Debian system. Then, run the following command to download the CMake tar.gz package:
The package is saved in your current Terminal directory as cmake-3.24.2.tar.gz. The CMake v3.24.2 is the latest version as of September 2022.
Step 2: Extract CMake and Run the Bootstrap
Now, you are required to uncompress the downloaded tar.gz archive. Run the following command to uncompress the cmake-3.24.2.tar.gz archive file:
It will uncompress the archive into a new directory cmake-3.24.2. Move into this directory using the cd command:
Once inside the cmake-3.24.2 directory, run the bootstrap script using the following command in the Terminal window:
Once the command is finished, you will see the following similar output:
Step 3: Install CMake
You can install CMake by following the two simple steps. First, run the cmake command:
Then, use the following command to install CMake:
Step 4: Verify Installation
To verify the installation of CMake, use the following command:
An output similar to the following screenshot that shows the CMake version will confirm the successful installation of CMake. If you do not receive such output, try again to perform the previously-mentioned steps.
Uninstall CMake
Based on how you installed CMake, there are two ways to remove it:
1. If you installed CMake via GUI, launch the Software Center, go to the Installed tab, and select CMake. Then, click Remove in order to uninstall CMake from your system.
2. If you installed CMake via the command line using the tar.gz archive, use the following method:
Move into the CMake directory which, in our scenario, is cmake-3.24.2:
Then, run the following command to uninstall CMake:
Conclusion
In this post, we covered the installation of CMake on Debian 11 using two different ways. Based on your preferences, you can choose either the graphical or command line method to install CMake. We also covered how to uninstall CMake if in case you need to remove it from your Debian system.
About the author
Karim Buzdar
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.
How To Install CMake On Ubuntu And Debian
Previously, CMake was introduced to you. To control the software compiler process, this open-sources software uses a simple platform and compiler-independent configuration files. In this way, native makefiles and workspaces would be produced to be used in a compiler environment of choice. Join us with this article to learn How To Install CMake On Ubuntu And Debian. Do not miss 2021 offers on Eldernode to purchase your own Linux VPS.
Tutorial Install CMake On Ubuntu And Debian
Prepare the latest version of CMake which is available on cmake.org/download/ and Snap Store. Also, pre-compiled binaries are available for some UNIX platforms and you can alternatively download and build CMake from the source. In this article, we will explain how you can install it through the Ubuntu & Debian Software Manager.
To let this tutorial work better, please consider the below Prerequisites:
A non-root user with sudo privileges.
How to install CMake on Ubuntu
Here, we will describe how to install CMake to your Ubuntu both through the UI and the command line. If you prefer to not open the Command line very much, you can install software present in the Ubuntu repository through the UI.
How to install CMake through UI
First, click the Ubuntu Software icon on your Ubuntu desktop Activities toolbar.
Then, if you search ”CMake” in the search bar, the first package listed is the one maintained by the Snap Store. Click on the CMake entry to open the page below:
To start the process of the installation, click on the Install button. Since only one authorized user is able to install software on Ubuntu, the authentication details will be displayed. So, enter your password to let the installation process begin.
Tracking the installation is like the image below:
Once the CMake is installed, you will receive the following message. So, you can choose to directly launch CMake or maybe Remove it if you wish.
How to install CMake through the Ubuntu Command Line
As we mentioned, you can install CMake through the command line. Download the source code from the Official CMake website, compile it and then install CMake through it. The same version could be installed by running the command below:
sudo apt update sudo apt upgrade sudo snap install cmake
To download the source code, type:
wget https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz
When the file is downloaded, use the following command to extract it:
To move to the extracted folder, run:
Next, use the following command to compile and install CMake.
Now, you can make it using the command below:
Once the installation is completed, you can verify its installation and check the correctness of the installed version. So, run:
When you checked for the latest version, you can use the CLI too to work with your software’s code.
Note: If you have already installed CMake using Ubuntu package manager, use the command below to remove it.
sudo apt remove --purge cmake hash -r
How To uninstall CMake Using The Ubuntu Software
When you decide to remove CMake from your system using the Graphical User Interface, it would not be so difficult. Let’s go through the steps of this part.
Search for ”CMake” on the search bar above. Then, click on the CMake application. The below windows should be displayed.
To uninstall CMake from your Ubuntu system, click on the ”Remove” button.
How to install CMake on Debian
The repository of Debian does not include any of the latest version of CMake. So, you need to download it firstly. Follow the below steps to learn CMake installation on Debian.
When you opened your terminal (Using Ctl+Alt+T) download CMake in your system. Run the command below and wait for the proceeding.
wget https://github.com/Kitware/CMake/releases/download/v3.15.2/cmake-3.15.2.tar.gz
Then, you should extract the downloaded file. So, type:
Now, use the cd command after extracting the director.
At this point, you can run the following command since you have reached the CMake directory. Wait for a while to see CMake will be bootstrapped.
You will do this step when CMake is bootstrapped. So, run the make command in the terminal window. Processing of the make will take time, so do not exit the terminal window and let it reach 100% completion.
Finally, to install CMake, type:
If you wish, verify the process of installation of CMake using the command below:
Once you view the version, you can ensure that the installation is confirmed. Otherwise, check the steps again or send us the error you receive.
Enabled snaps on Debian and install CMake
Also on Debian, you can use snaps to install CMake. Snaps are applications packaged with all their dependencies. Snapes could be run on all Linux distributions from a single build. Snap Store is the best place you can install snaps.
To install snap directly from the command line, run:
Then, use the following commands to install CMake on your Debian Server:
sudo snap install cmake --classic
Conclusion
In this article, you learned How To Install CMake On Ubuntu And Debian. Two methods of installing CMake was presented to you for both Ubuntu and Debian. In case you are interested in learning more, find the related article on How To Install CMake On Windows Server.
Click on a star to rate it!
Average rating 1 / 5. Vote count: 1
No votes so far! Be the first to rate this post.