Skip to content

Instantly share code, notes, and snippets.

@mherkazandjian
Last active March 1, 2022 13:38
Show Gist options
  • Save mherkazandjian/fba54cd94316bfc1b1693a6ba2625f50 to your computer and use it in GitHub Desktop.
Save mherkazandjian/fba54cd94316bfc1b1693a6ba2625f50 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
##################################################
# usage:
# # quick install
# $ ./install_cmake.sh
# # quick install with a custom install path / prefix
# $ ./install_cmake.sh /opt/cmake
# execute the script without saving it to disk:
# $ curl -s https://gist.githubusercontent.com/mherkazandjian/fba54cd94316bfc1b1693a6ba2625f50/raw/2a1cefe9951bf6bd94910aefebb59d22eb85599c/cmake_installer.sh | bash
##################################################
# the installation root directory of cmake (e.g /opt/cmake)
INSTALL_PREFIX=$1
shift
if [[ ! -z ${INSTALL_PREFIX} ]]; then
ARGS="--prefix="${INSTALL_PREFIX}
fi
function _install_cmake() {
wget https://github.com/Kitware/CMake/releases/download/v3.22.2/cmake-3.22.2.tar.gz -O cmake-3.22.2.tar.gz
tar -xvf cmake-3.22.2.tar.gz
cd cmake-3.22.2
./bootstrap
./configure ${ARGS}
make
make install
}
_install_cmake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment