update
This commit is contained in:
57
cmake_script.sh
Normal file
57
cmake_script.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Function to install the latest CMake
|
||||
install_cmake() {
|
||||
# Install required packages
|
||||
sudo apt update
|
||||
sudo apt install -y libssl-dev
|
||||
|
||||
# Download the latest CMake source
|
||||
git clone https://ghproxy.dockless.eu.org/https://github.com/Kitware/CMake.git
|
||||
cd CMake
|
||||
|
||||
# Create build directory
|
||||
mkdir build && cd build
|
||||
|
||||
# Bootstrap and build CMake from the build directory
|
||||
../bootstrap && make
|
||||
|
||||
# Install CMake
|
||||
sudo make install
|
||||
|
||||
# Cleanup: go back to parent directory and remove CMake source directory
|
||||
cd ../..
|
||||
rm -rf CMake
|
||||
}
|
||||
|
||||
# Function to uninstall CMake
|
||||
uninstall_cmake() {
|
||||
# Assuming CMake was installed from a build directory
|
||||
cd CMake/build
|
||||
|
||||
# Uninstall CMake
|
||||
sudo make uninstall
|
||||
|
||||
# Cleanup: go back to parent directory and remove CMake source directory
|
||||
cd ../..
|
||||
rm -rf CMake
|
||||
}
|
||||
|
||||
# Check for arguments
|
||||
if [ "$1" == "install" ]; then
|
||||
install_cmake
|
||||
elif [ "$1" == "uninstall" ]; then
|
||||
uninstall_cmake
|
||||
else
|
||||
echo "Usage: $0 [install|uninstall]"
|
||||
fi
|
||||
|
||||
# Remove the old version: for debian
|
||||
|
||||
# sudo apt remove --purge cmake
|
||||
# hash -r
|
||||
# Install the latest CMake using Snappy:
|
||||
# sudo snap install cmake --classic
|
||||
# add bashrc
|
||||
# export PATH=/snap/bin:$PATH
|
||||
|
||||
Reference in New Issue
Block a user