如何在 Linux 上下载、编译和安装 CMake

更新时间:2023-12-02 下载TXT文档 下载Word文档

CMake is a cross-platform, open-source build system. CMake is a family of tools designed to build, test and package software.

Here are the simple steps to download, configure, compile, and install CMake on a Linux machine. I have tested these instructions on Debian/Ubuntu Linux distributions but they should work on all Linux machines where compilers and make utilities are installed. Please take a look at configuring Ubuntu Linux after installation to configure your Debian/Ubuntu Linux box for the required tools.

Please make sure you check the downloaded file's integrity before unzipping it. '#' (w/o quotes) in front of commands below means you have to run the command as root user (or use sudo instead if your system supports that).

Download:

$ wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz

Extration of cmake source code from downloaded file:

$ tar xzf cmake-2.8.3.tar.gz
$ cd cmake-2.8.3

Configuration:

If you want to see the available conifuration options, run command below. 短码网-DuanMa.NET

$ ./configure --help

In order to configure cmake before installation, run command below.

$ ./configure --prefix=/opt/cmake

We basically instructed the install script to install CMake in /opt/cmake.

Compilation:

$ make

Installation:

# make install

Verification:

After installation without any errors you can verify the installation by running the command below:

$ /opt/cmake/bin/cmake -version

The output should look something like below (depending upon cmake version you are installing).

cmake version 2.8.3

Please feel free to use the comments form below if you have any questions or need more explanation on anything. Use the icons below to share this tutorial with your friends.

以上就是短码网小编为大家整理的《如何在 Linux 上下载、编译和安装 CMake》相关内容,希望大家喜欢。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。

如若内容造成侵权/违法违规/事实不符,请将联系本站反馈,一经查实,立即处理!

如何在 Linux 上下载、编译和安装 CMake》文档下载仅供参考学习,下载后请在24小时内删除。

转载注明出处:https://www.duanma.net/article/094436a9021.html

回到顶部