summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-08-19 13:49:38 +0200
committerGitHub <noreply@github.com>2024-08-19 13:49:38 +0200
commitac9398ed2144d9c364c771e638b9e098420b96e9 (patch)
tree97ea8f1b3cf4e04ef6d161e37ffc7b7bdfb9cba3
parent57769fac7d57b55394b2ed8cc07f631904e7538b (diff)
downloadspack-ac9398ed2144d9c364c771e638b9e098420b96e9.tar.gz
spack-ac9398ed2144d9c364c771e638b9e098420b96e9.tar.bz2
spack-ac9398ed2144d9c364c771e638b9e098420b96e9.tar.xz
spack-ac9398ed2144d9c364c771e638b9e098420b96e9.zip
build_environment: explicitly disable ccache if disabled (#45275)
-rw-r--r--lib/spack/spack/build_environment.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index c02c3bc818..7b02dbcae2 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -457,9 +457,12 @@ def set_wrapper_variables(pkg, env):
env.set(SPACK_DEBUG_LOG_ID, pkg.spec.format("{name}-{hash:7}"))
env.set(SPACK_DEBUG_LOG_DIR, spack.main.spack_working_dir)
- # Find ccache binary and hand it to build environment
if spack.config.get("config:ccache"):
+ # Enable ccache in the compiler wrapper
env.set(SPACK_CCACHE_BINARY, spack.util.executable.which_string("ccache", required=True))
+ else:
+ # Avoid cache pollution if a build system forces `ccache <compiler wrapper invocation>`.
+ env.set("CCACHE_DISABLE", "1")
# Gather information about various types of dependencies
link_deps = set(pkg.spec.traverse(root=False, deptype=("link")))