aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index b461f2d..2caddde 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -959,11 +959,14 @@ class Compiler:
extra_args = []
try:
with tempfile.TemporaryDirectory(dir=temp_dir) as tmpdirname:
+ no_ccache = False
if isinstance(code, str):
srcname = os.path.join(tmpdirname,
'testfile.' + self.default_suffix)
with open(srcname, 'w') as ofile:
ofile.write(code)
+ # ccache would result in a cache miss
+ no_ccache = True
elif isinstance(code, mesonlib.File):
srcname = code.fname
@@ -987,6 +990,8 @@ class Compiler:
mlog.debug('Code:\n', code)
os_env = os.environ.copy()
os_env['LC_ALL'] = 'C'
+ if no_ccache:
+ os_env['CCACHE_DISABLE'] = '1'
p, p.stdo, p.stde = Popen_safe(commands, cwd=tmpdirname, env=os_env)
mlog.debug('Compiler stdout:\n', p.stdo)
mlog.debug('Compiler stderr:\n', p.stde)