Skip to content

Instantly share code, notes, and snippets.

@LB--
Last active August 11, 2019 17:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LB--/5e01a8fecefad74889a5 to your computer and use it in GitHub Desktop.
Save LB--/5e01a8fecefad74889a5 to your computer and use it in GitHub Desktop.
CMake Bootstrap

Read Me

Building a newer version of CMake yourself is pretty simple, especially with bootstrapping (using an older version of CMake to build the never version).

  1. Place this CMakeLists.txt file in a dedicated CMake folder.
  2. In this folder, create a build folder and from within it run cmake .. && cmake --build .
  3. Your new version of CMake will be installed into install, so you can add install/bin to your PATH
  4. To upgrade again, delete the install folder and in the build folder run cmake --build . again
  5. When install/bin is in your PATH, check the version of CMake with cmake --version
  6. Use your upgraded CMake to modernize your existing CMake projects and build other people's projects that require it
  7. Share this script to make other people's lives easier - nobody likes using outdated software
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)
ExternalProject_Add(CMake
GIT_REPOSITORY "git://github.com/Kitware/CMake.git"
# GIT_TAG "next"
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_LIST_DIR}/install"
# "-DBUILD_SHARED_LIBS=OFF"
TEST_EXCLUDE_FROM_MAIN 1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment