Skip to content

Instantly share code, notes, and snippets.

@shwu-nyunai
Last active April 21, 2024 17:06
Show Gist options
  • Save shwu-nyunai/0ef39aa02ff43915ce82048c148cfd21 to your computer and use it in GitHub Desktop.
Save shwu-nyunai/0ef39aa02ff43915ce82048c148cfd21 to your computer and use it in GitHub Desktop.
Update cmake
# Remove any existing CMake installation
echo "Removing existing CMake installation..."
sudo apt remove cmake -y
# Install build-essential package
echo "Installing build-essential package..."
sudo apt-get install build-essential
# Download CMake 3.2.2 source code
echo "Downloading CMake 3.2.2 source code..."
wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
# Extract the downloaded archive
echo "Extracting the downloaded archive..."
tar xf cmake-3.2.2.tar.gz
# Navigate to the extracted directory
cd cmake-3.2.2
# Configure the CMake build
echo "Configuring the CMake build..."
./configure
# Build CMake
echo "Building CMake..."
make
# If make finishes without errors:
if [ $? -eq 0 ]; then
echo "Make completed successfully."
# Install CMake
echo "Installing CMake..."
sudo make install
# Update PATH and LD_LIBRARY_PATH
echo "Updating PATH and LD_LIBRARY_PATH..."
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Verify CMake version
echo "Verifying CMake version..."
cmake --version
else
echo "An error occurred during the build process."
fi
# Navigate back to the parent directory
cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment