cmake mac下安装

最近入职新公司压力还是比较大,节奏比较快,项目方面都是用c++写的,还是从头开始学c++,不知道能坚持多久,还是慢慢的记录下,想想一路做算法过来真累,学习各种编程语言,c++还是绕不过,学习也是周末和晚上抽时间来学习下,平时毕竟还有其他工作要做;cmake我理解相当于java里面的maven一样,是一个相当好用的工具,只需要自己写好CMakeLists.txt,其余都是一键打包,生成可执行文件,例如mac下面的dylib、linux下的so、windows下的dll。


mac下的安装:

在mac上,想安装一下cmake,就把过程写下来吧(没有使用brew)。

       首先去cmake,官网,下载Mac操作系统对应的安装包https://cmake.org/download/,我下载的是cmake3.7.2。安装完成之后,运行cmake图形界面程序,在左上角的选项栏中选择Tools,点击How to install for Command Line Use。之后弹出来一个消息框:

One may add CMake to the PATH:
PATH="/Applications/CMake.app/Contents/bin":"$PATH"
Or, to install symlinks to '/usr/local/bin', run:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
Or, to install symlinks to another directory, run:
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install=/path/to/bin

也就是说官方给出了三种安装cmake command line tool 的方法,即终端能够识别cmake命令的方法。我选择了官方给出的第二种方法,即复制sudo"/Applications/CMake.app/Contents/bin/cmake-gui" --install  命令到终端,然后运行,当然你也可以打出来。 之后再在终端打cmake命令,就不会再提示什么command not found之类的错误了,到此安装成功了。


在终端打开运行cmake命令看下:

cmake
Usage
  cmake [options] <path-to-source>

  cmake [options] <path-to-existing-build>

Specify a source directory to (re-)generate a build system for it in the

current working directory.  Specify an existing build directory to

re-generate its build system.

Run 'cmake --help' for more information.
出现这个表示安装成功





  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值