Skip to content

Always FetchContent dependencies; drop $ENV{CODE} local-source bypass#319

Merged
krystophny merged 1 commit into
mainfrom
hermetic-fetchcontent-deps
Jun 15, 2026
Merged

Always FetchContent dependencies; drop $ENV{CODE} local-source bypass#319
krystophny merged 1 commit into
mainfrom
hermetic-fetchcontent-deps

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

find_or_fetch in cmake/Modules/Util.cmake silently substituted a local checkout at $ENV{CODE}/<dep> whenever CODE was 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 in BuildExternalDependencies.cmake. The environment is never read.

Verification

Confirmed no $ENV{CODE} remains in the cmake sources:

$ rg -i '\$ENV\{CODE\}' cmake
(no matches)

Fresh configure with CODE set to a sentinel path does not reference it and succeeds:

$ CODE=/tmp/should-not-be-used cmake -S . -B /tmp/libneo-cfg -G Ninja
...
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/libneo-cfg

No "Using ... in /tmp/should-not-be-used" message appears; dependencies resolve via FetchContent / system detection.

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.
@krystophny krystophny merged commit 137fc8d into main Jun 15, 2026
4 checks passed
@krystophny krystophny deleted the hermetic-fetchcontent-deps branch June 15, 2026 21:29
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