Skip to content

Resolve CPM dependencies from CPM's package registry - #41

Merged
sean-parent merged 2 commits into
mainfrom
cpm-dependency-tracking
Nov 18, 2026
Merged

sean-parent merged 2 commits into
mainfrom
cpm-dependency-tracking

Conversation

@sean-parent

Copy link
Copy Markdown
Member

Summary

  • Cached CPM packages are now tracked. When CPM serves a package from CPM_SOURCE_CACHE, it adds the package with add_subdirectory() and never calls FetchContent_MakeAvailable(), so the dependency provider never saw it. Generated configs then fell back to a find_dependency() call with no version, and install validation failed. Namespaced dependencies now resolve from CPM's package registry (CPM_PACKAGES and CPM_PACKAGE_<name>_VERSION).
  • CPM versions are now recorded. Even when the cache is empty, CPM sets <name>_VERSION only after the provider runs, so tracked CPM dependencies had no version. The registry now supplies it. CPM's placeholder version 0 is omitted.
  • The provider records only package names. It now tracks only the dependency name from FETCHCONTENT_MAKEAVAILABLE_SERIAL. Previously it also recorded every FetchContent_Declare() argument (SOURCE_DIR, paths, GIT_TAG, and so on) as a package.
  • Troubleshooting text is corrected. The README's untracked-dependency section and the install error messages no longer blame subdirectories; the actual cause was the cache bypass.

Found while working on stlab/cel-parser: cel::runtime went untracked whenever the CPM cache was warm.

Test plan

  • cmake -P tests/install/CMakeLists.txt passes (38 tests), including the new test_cpm_registry.cmake. Five of its assertions failed before the fix.
  • These test scripts pass locally on macOS: test_provider_merge, test_nested_install, test_package_ci, test_target_type, test_install_dirs, test_runtime_dlls, test_setup_version_resolution, test_docs, and test_clangd (AppleClang).
  • cel-parser builds against this branch with a warm cache, using CPMAddPackage("gh:stlab/cel-runtime@1.1.0#<sha>") and no cpp_library_map_dependency call. It generates find_dependency(cel-runtime 1.1.0) and passes install validation.
  • CI only: the Ubuntu integration-tests job and the Windows and Linux job variants.

Generated with GitHub Copilot CLI

sean-parent and others added 2 commits November 17, 2026 21:59
CPM serves packages from CPM_SOURCE_CACHE through add_subdirectory() without
calling FetchContent_MakeAvailable(), so the dependency provider never saw
them and generated package configs fell back to versionless, unverified
find_dependency() calls. Even on a cold cache, CPM sets <name>_VERSION only
after the provider runs, so tracked CPM dependencies lost their versions.

Resolve namespaced dependencies from CPM_PACKAGES and
CPM_PACKAGE_<name>_VERSION when the provider recorded no more than a bare
package name. Track only the dependency name from
FETCHCONTENT_MAKEAVAILABLE_SERIAL; the remaining arguments are its
FetchContent_Declare() details, not packages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Omit versions CPM derives from abbreviated hashes and branch names, since they are not reliable package constraints.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@sean-parent sean-parent left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talos local review

No issues found. Reviewed 1ccd0a3d793fbd12201dbd26a6f41f1ff2604172 against origin/main.

Files Reviewers Candidates → validated → accepted Shown Tests
6 6 personas, challenge 0 → 0 → 0 0 of 0 cmake -P tests/install/CMakeLists.txt: 41 assertions passed, 0 failed

No inline findings were posted. The specialized Talos challenge persona was unavailable; a separate code-review agent challenged the empty candidate set and returned no accepted or rejected observations. Scout was used (risk MEDIUM, evidence LOW; complete) and supplied leads only. The prior PR head 9e9afc2 had all seven CI checks passing; CI for this new head was not yet available at publication time.

Persona routing: static roster (DCAP routing off; rerun with --dcap to enable).

Org knowledge: off (rerun with --knowledge).

Scout

Used: risk MEDIUM, evidence LOW, status COMPLETE (scout 0.9.135, <1s).
Cross-file leads given to reviewers: 0 changed symbol(s) with uses outside the diff, 0 new value(s) not handled everywhere, 1 possibly unused symbol(s).
Scout rated its evidence LOW for this change; reviewers used it only as leads.

Scout could not map this change to specific symbols, so its affected-test list (based on whole files) is left out. For it, run scout affected-tests -r '/Users/sean-parent/repos/github.com/stlab/cpp-library/.claude/worktrees/cpm-dependency-tracking' -s compare -b origin/main.

@sean-parent
sean-parent merged commit df18f94 into main Nov 18, 2026
7 checks passed
@sean-parent
sean-parent deleted the cpm-dependency-tracking branch November 18, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant