Skip to content

Hermetic install-only configure: gate ccache detection on LIBFN_TESTS, align overlay port #418

Description

@Bronek

Background

During review of the vcpkg registry submission (microsoft/vcpkg#53682), the vcpkg maintainer flagged that the port did not fully control upstream's optional build dependencies: cmake/Ccache.cmake runs find_program(ccache) in every top-level configure and selects it as CMAKE_CXX_COMPILER_LAUNCHER when present, so the configure result depends on what happens to be installed on the build host. The registry port now passes -DDISABLE_CCACHE_DETECTION=ON (merged from Bronek/vcpkg#1).

The registry flag treats the symptom. This issue addresses the root cause and the remaining in-repo alignment, in one change:

1. Gate ccache detection on LIBFN_TESTS (root cause)

include(Ccache) (CMakeLists.txt, top-level branch) runs even when LIBFN_TESTS=OFF — but in that configuration nothing compiles at all: the library is header-only, and both LIBFN_DOCS and LIBFN_COVERAGE hard-require LIBFN_TESTS=ON. A compiler launcher can serve no purpose there; only the nondeterministic host probe remains.

Gating include(Ccache) on LIBFN_TESTS makes every install-only configure hermetic by construction:

  • packagers (vcpkg, nixpkgs, anyone downstream) no longer need to know DISABLE_CCACHE_DETECTION exists;
  • the plain-CMake install route to be documented per README: document the plain CMake install route #413 (cmake -B .build -DLIBFN_TESTS=OFF) probes no host tools;
  • developer builds (tests on) keep ccache detection exactly as today, and the DISABLE_CCACHE_DETECTION option/env escape remains for them.

2. Align the in-repo overlay port

ports/libfn/portfile.cmake configures with only -DLIBFN_TESTS=OFF — the same omission the registry port had. Add -DDISABLE_CCACHE_DETECTION=ON to match the registry port. This stays correct regardless of item 1: the overlay port must also build pinned releases (v0.1.0) whose CMakeLists predates the gate.

3. flake.nix consistency (optional)

flake.nix does not disable the detection either. The nix sandbox makes the probe deterministic (ccache is never present unless declared), so this is consistency rather than correctness — nixpkgs' package.nix disables it explicitly. Item 1 makes this moot for install-only use; decide whether the flake's test-enabled dev shell wants ccache detection kept.

Assisted-by: Claude:claude-fable-5

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolchainSupported compilers, tools or workflows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions