linux下安装cmake方法

来源:互联网 发布:win7软件启动慢 编辑:程序博客网 时间:2024/06/13 09:25
inux下安装软件的源码包很多都需要使用cmake进行编译,因此需要我们先给linux系统安装cmake
  1、打开网址:http://www.cmake.org/cmake/resources/software.html,找到最新版本的位置。一般开放源代码软件都会有两个版本发布:Source Distribution 和 Binary Distribution,前者是源代码版,你需要自己编译成可执行软件。后者是已经编译好的可执行版,直接可以拿来用的。

2、查看linux的位数,输入:
[root@xjfw3 ~]# getconf LONG_BIT64[root@xjfw3 ~]#
如果结果是64表示该系统是linux64位的,如果结果是32则表示系统是linux32位。
3、我现在所用的这台是64位,因此在cmake安装包的网站中选择binary distribution下的linux x86_64下的cmake-3.10.0-rc4-Linux-x86_64.tar.gz压缩包。
4、把下载好的包上传到指定路径,比如/root ,然后进行解压。
[root@xjfw3 ~]# tar -zxvf cmake-3.10.0-rc4-Linux-x86_64.tar.gz
5、把解压后的cmake-3.10.0-rc4-Linux-x86_64目录该名为cmake。
[root@xjfw3 ~]# mv cmake-3.10.0-rc4-Linux-x86_64 cmake
 6.编辑.bash_profile,找到export PATH=这些行,在这些行的后面添加:/root/cmake/bin,从而设置环境变量。
[root@xjfw3 ~]# vi .bash_profile # .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then        . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/bin:/root/cmake/binexport PATH
输入完毕保存
  7.查看版本,测试是否安装成功。
[root@xjfw3 ~]# cmake --versioncmake version 3.10.0-rc4CMake suite maintained and supported by Kitware (kitware.com/cmake).[root@gsxjfw3 ~]# 
  结果是:cmake version 3.10.0(安装cmake成功!)


原创粉丝点击