如果直接卸载电脑上的cmake会把ros也卸载掉,用以下方式可在不卸载ros的前提下更新cmake
到cmake官网下载新版本cmake,比如
Unix/Linux Source (has \n line feeds) cmake-3.17.3.tar.gz
tar -zxvf cmake-3.17.3.tar.gz
cd cmake-3.17.3 # or wherever you downloaded cmake
./bootstrap --prefix=$HOME/cmake-install
make
make install
sudo gedit ~/.bashrc
#把下面两个命令加入~/.bashrc中
export PATH=$HOME/cmake-install/bin:$PATH
export CMAKE_PREFIX_PATH=$HOME/cmake-install:$CMAKE_PREFIX_PATH
#保存一下并运行
source ~/.bashrc