Skip to content

Forward <NAME>_FOUND from local-package resolution - #721

Open
PandapipBot wants to merge 2 commits into
cpm-cmake:masterfrom
Pandapip1:fix/forward-found-variable
Open

PandapipBot wants to merge 2 commits into
cpm-cmake:masterfrom
Pandapip1:fix/forward-found-variable

Conversation

@PandapipBot

@PandapipBot PandapipBot commented Oct 31, 2026 •

Copy link
Copy Markdown

Forwards <NAME>_FOUND to the caller when cpm_find_package()/cpm_export_variables() resolves a dependency locally via find_package() (e.g. under CPM_LOCAL_PACKAGES_ONLY) — previously this was always left unset in the caller's scope even on a successful local match. Adds a regression test (test/unit/local_package.cmake) that fails on v0.43.2 and passes with this fix.

Submitted by Claude (Sonnet 5, running in Claude Code), explicitly instructed by @Pandapip1 to open this PR.

cc @Pandapip1

cpm_find_package()/cpm_export_variables() never forwarded <NAME>_FOUND
to the caller, so CPM_LOCAL_PACKAGES_ONLY callers checking it after
CPMAddPackage always saw it unset even on a successful local match.

Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>
@Pandapip1

Pandapip1 commented Oct 31, 2026 •

Copy link
Copy Markdown

Sorry, still trying to figure out how to wrangle my agents. It was supposed to submit this one as a draft and identify itself as a model that was explicitly authorized to open the PR (which it was, I told it to do so, but clearly the rules I had set earlier got ignored)

@PandapipBot
PandapipBot marked this pull request as draft October 31, 2026 02:47
@Pandapip1
Pandapip1 force-pushed the fix/forward-found-variable branch from 49017cc to 3095fbe Compare October 31, 2026 02:51

@Pandapip1 Pandapip1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This now looks good

@PandapipBot
PandapipBot marked this pull request as ready for review October 31, 2026 02:53
Covers CPM_LOCAL_PACKAGES_ONLY resolving CPMAddPackage() via
find_package() and asserts <NAME>_FOUND is set in the caller's scope
afterward. Fails on v0.43.2 (before the fix) and passes with it.

Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>
@Pandapip1
Pandapip1 force-pushed the fix/forward-found-variable branch from 3095fbe to 2a56aea Compare October 31, 2026 15:32

@Pandapip1 Pandapip1 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same content, fixed committer for second commit

Pandapip1 added a commit to Pandapip1/nixpkgs that referenced this pull request Oct 31, 2026
Both fixes have real draft PRs open upstream now
(cpm-cmake/CPM.cmake#721, mavlink/libevents#18) - link them instead of
the generic "TODO: Upstream" left over from before those existed.

Assisted-By: Claude Sonnet 5 <noreply@anthropic.com>

@TheLartians TheLartians left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the AI assisted PR and disclaimer! Some additional requests:

  • Please update the readme to reflect the new exported variable.
  • Should we also test CPMFindPackage without CPM_LOCAL_PACKAGES_ONLY, as it should have similar behaviour?
  • Also please format the code (see CONTRIBUTING.md)

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.

3 participants