MAC下cmake安装

Posted abc_begin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MAC下cmake安装相关的知识,希望对你有一定的参考价值。

可以参考网上手动下载cmake的源码包进行安装,http://www.cmake.org/download/

解压后运行sudo ./bootstrap && sudo make && sudo make install

但是在执行./bootstrap的时候报以下错误:

/Users/baidu/cmake-3.9.0/Source/cmSystemTools.cxx:2061:39: error: expected \';\' after expression
exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
^
;
/Users/baidu/cmake-3.9.0/Source/cmSystemTools.cxx:2061:13: error: use of undeclared identifier \'CMAKE_BOOTSTRAP_BINARY_DIR\'
exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
^
/Users/baidu/cmake-3.9.0/Source/cmSystemTools.cxx:2121:28: error: use of undeclared identifier \'CMAKE_BOOTSTRAP_SOURCE_DIR\'
cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
^
/Users/baidu/cmake-3.9.0/Source/cmSystemTools.cxx:2061:40: warning: expression result unused [-Wunused-value]
exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
^~~~~~
1 warning and 3 errors generated.
make: *** [cmSystemTools.o] Error 1
---------------------------------------------
Error when bootstrapping CMake:
Problem while running make
---------------------------------------------
Log of errors: /Users/baidu/cmake-3.9.0/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------

 

在网上找了好久也没有找到解决办法,遂决定采用brew来安装了。brew是个什么东东呢?其实就是linux系统下面的apt-get、yum神器。

安装brew只需要一条命令即可:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

这就成了,brew就用下面3条命令即可:

搜索软件:brew search 软件名,如brew search wget

安装软件:brew install 软件名,如brew install wget

卸载软件:brew remove 软件名,如brew remove wget

 

bogon:wabase iwaimai$ brew search cmake
==> Searching local taps...
cmake
==> Searching taps on GitHub...
caskroom/cask/cmake
==> Searching blacklisted, migrated and deleted formulae...


bogon:wabase iwaimai$ brew install cmake
==> Downloading https://homebrew.bintray.com/bottles/cmake-3.10.2.high_sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cmake-3.10.2.high_sierra.bottle.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/cmake
==> Summary

以上是关于MAC下cmake安装的主要内容,如果未能解决你的问题,请参考以下文章

mac os cmake安装

Mac下安装pcl-1.8.0

mac安装了cmake: command not found

mac osx 下安装opencv

Mac OS下安装测试gtest

Mac平台 使用CMake编译iOS lib