Always FetchContent dependencies; drop $ENV{CODE} local-source bypass#319
Merged
Conversation
find_or_fetch silently used a local checkout whenever CODE was set in the shell environment, making dependency resolution depend on ambient state. Default to FetchContent at the declared ref; allow a local source only through an explicit -D<DEP>_SOURCE_DIR cache variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
find_or_fetchincmake/Modules/Util.cmakesilently substituted a local checkout at$ENV{CODE}/<dep>wheneverCODEwas set in the shell. Dependency resolution then depended on ambient environment state rather than the declared ref, which is a hermeticity footgun.This change makes the helper default to FetchContent (fetch each dependency at its pinned/declared ref). A local source is used only when explicitly requested via the
-D<DEP>_SOURCE_DIR=<dir>CMake cache variable, matching the cache-variable override convention already used inBuildExternalDependencies.cmake. The environment is never read.Verification
Confirmed no
$ENV{CODE}remains in the cmake sources:Fresh configure with
CODEset to a sentinel path does not reference it and succeeds:No "Using ... in /tmp/should-not-be-used" message appears; dependencies resolve via FetchContent / system detection.