fix(build): default CPM_SOURCE_CACHE to repo-local cache to enable incremental builds (#2735)

Without a stable CPM_SOURCE_CACHE, FetchContent_Populate runs on every cmake
configure (new session), triggering ExternalProject's git fetch/checkout and
touching header timestamps in _deps/<name>-src/. This causes a complete C++
rebuild on every `uv build` even with no source changes.

Defaulting CPM_SOURCE_CACHE to .cpm_cache/ in the repo root ensures CPM skips
FetchContent_Populate for already-downloaded packages, keeping header timestamps
stable. Users can still override via the CPM_SOURCE_CACHE env var.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ian Bell
2026-04-18 14:20:49 -04:00
committed by GitHub
parent 3040ebf26e
commit 74e7595def
2 changed files with 8 additions and 2 deletions

1
.gitignore vendored
View File

@@ -12,6 +12,7 @@ Web/fluid_properties/fluids/molecule_sdf/
.version
/bld*
/.cpm_cache/
/dev/VS2010

View File

@@ -1,6 +1,11 @@
# Dependencies for CoolProp managed via CPM.cmake
# Set CPM_SOURCE_CACHE in your environment (e.g. ~/.cache/CPM) to share the
# download cache across git worktrees and build directories.
# CPM_SOURCE_CACHE can be overridden via environment variable (e.g. ~/.cache/CPM)
# to share the download cache across git worktrees and build directories.
# Without a stable cache location, FetchContent re-runs on every cmake configure,
# touching header timestamps and forcing a complete C++ rebuild each time.
if(NOT DEFINED CPM_SOURCE_CACHE AND "$ENV{CPM_SOURCE_CACHE}" STREQUAL "")
set(CPM_SOURCE_CACHE "${CMAKE_CURRENT_LIST_DIR}/../.cpm_cache" CACHE PATH "CPM source cache")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/CPM.cmake")