Linux HOWTOs

About | Home | Search

HOWTO: cmake
Description: Cross-platform Make
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything

# CMake 3.6.1
# ===========
# If you'd rather go with pre-compiled binaries:
# Linux x86_64
# Linux i386

# To clean up files from an old version before installing this one,
# or to uninstall CMake, skip down to the bottom for instructions

# Prerequisites (in that configure looks for or tries to run them):
# Qt4 (optional; for the Qt-based GUI)
# Subversion (optional)

# Get it
test -f installed/cmake-3.6.1.tar.gz &&
 mv installed/cmake-3.6.1.tar.gz .
test ! -f cmake-3.6.1.tar.gz &&
 wget --no-check-certificate

# Verify tarball w/ sha256sum:
echo "28ee98ec40427d41a45673847db7a905b59ce9243bb866eaf59dce0f58aaef\
11  cmake-3.6.1.tar.gz" | sha256sum -c

# Extract the source
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "cmake-*" -exec rm -r {} \;
tar xzvf ~/cmake-3.6.1.tar.gz
cd cmake-3.6.1
test $UID = 0 && chown -R root:root .

# Configure the build
./bootstrap --prefix=/usr

# Build it

# Become root to install it

# Remove the Slackware package, if there is one
# Note:
#   I have a /usr/share/cmake/ that comes from the libproxy package
#   Slackware's and the source original use /usr/share/cmake-x.x.x
test -x /sbin/removepkg && /sbin/removepkg cmake

# Install the new one
make install

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again

# Save the source for later
mkdir -p -m 0700 installed
rm -f installed/cmake-*.tar.*
mv cmake-3.6.1.tar.gz installed/

# If you ever want to uninstall CMake, this should do it:
test -d src/cmake-* && ( cd src/cmake-* ; make uninstall )
for pfx in /usr/local /usr;
  ( cd ${pfx}/bin ; rm -f ccmake cmake cpack ctest )
  find ${pfx}/doc -maxdepth 1 -type d -name "cmake-*" -exec rm -r {} \;
  ( cd ${pfx}/man
    rm -f ccmake.1 cmake.1 cpack.1 ctest.1 \
      cmakecommands.1 cmakecompat.1 cmakemodules.1 cmakepolicies.1 \
      cmakeprops.1 cmakevars.1 )
  find ${pfx}/share -maxdepth 1 -type d -name "cmake-*" -exec rm -r {} \;
find ~/src -maxdepth 1 -type d -name "cmake-*" -exec rm -r {} \;
rm -f ~/installed/cmake-*.tar.*

Back to the list

Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>