Repository navigation
Resolve CPM dependencies from CPM's package registry - #41
Conversation
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
left a comment
There was a problem hiding this comment.
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.
Summary
CPM_SOURCE_CACHE, it adds the package withadd_subdirectory()and never callsFetchContent_MakeAvailable(), so the dependency provider never saw it. Generated configs then fell back to afind_dependency()call with no version, and install validation failed. Namespaced dependencies now resolve from CPM's package registry (CPM_PACKAGESandCPM_PACKAGE_<name>_VERSION).<name>_VERSIONonly after the provider runs, so tracked CPM dependencies had no version. The registry now supplies it. CPM's placeholder version0is omitted.FETCHCONTENT_MAKEAVAILABLE_SERIAL. Previously it also recorded everyFetchContent_Declare()argument (SOURCE_DIR, paths,GIT_TAG, and so on) as a package.Found while working on stlab/cel-parser:
cel::runtimewent untracked whenever the CPM cache was warm.Test plan
cmake -P tests/install/CMakeLists.txtpasses (38 tests), including the newtest_cpm_registry.cmake. Five of its assertions failed before the fix.test_provider_merge,test_nested_install,test_package_ci,test_target_type,test_install_dirs,test_runtime_dlls,test_setup_version_resolution,test_docs, andtest_clangd(AppleClang).CPMAddPackage("gh:stlab/cel-runtime@1.1.0#<sha>")and nocpp_library_map_dependencycall. It generatesfind_dependency(cel-runtime 1.1.0)and passes install validation.integration-testsjob and the Windows and Linux job variants.Generated with GitHub Copilot CLI