下载CMake
cmake_version="3.28.1"
target_path=/usr/local/cmake_${cmake_version}
cmake_url="https://cmake.org/files/v${cmake_version%.*}/cmake-${cmake_version}-linux-x86_64.tar.gz"
mkdir -p "${target_path}"
curl -# -Ls "${cmake_url}" | tar -xz -C "${target_path}" --strip-components=1
ln -s ${target_path} /usr/local/cmake
设置环境变量
编辑$HOME/.zhsrc,添加如下内容
export PATH=/usr/local/cmake/bin:$PATH
查看版本
~ ❯ cmake --version 12:51:54
cmake version 3.28.1
CMake suite maintained and supported by Kitware (kitware.com/cmake).