# Bootstraps CPM.cmake. # # Inside the nix devShell CPM_CMAKE_PATH points at the nixpkgs-provided copy, # so a fresh configure touches the network zero times. Everywhere else this # falls back to the pinned release download, byte-identical to that copy # (verified: both hash to a609e875...), so the two paths cannot diverge. set(CPM_DOWNLOAD_VERSION 0.42.3) set(CPM_DOWNLOAD_HASH SHA256=a609e875fd532b067174250f6abbc3dac22fe2d64869783fb1e80bda1625c844) # CPM caches its own path in CPM_DIRECTORY, and when a later include comes from # a different path it assumes an enclosing project already loaded CPM, then # returns without defining CPMAddPackage. The two copies above live at # different paths (as does every nix store revision of the first), so a build # dir configured both inside and outside the devShell broke with "Unknown CMake # command". Nothing loads CPM before the top-level project, so a cached value # here is always stale. if (PROJECT_IS_TOP_LEVEL) unset(CPM_DIRECTORY CACHE) endif () if (DEFINED ENV{CPM_CMAKE_PATH} AND EXISTS "$ENV{CPM_CMAKE_PATH}") message(STATUS "CPM: using $ENV{CPM_CMAKE_PATH}") include("$ENV{CPM_CMAKE_PATH}") else () set(CPM_DOWNLOAD_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake") file( DOWNLOAD "https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake" "${CPM_DOWNLOAD_LOCATION}" EXPECTED_HASH ${CPM_DOWNLOAD_HASH}) include("${CPM_DOWNLOAD_LOCATION}") endif ()