From 6a6efdcaedc6f87fbafd40af5305cabdced450c4 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Thu, 1 Jul 2021 11:47:52 +0200 Subject: Makefiles: Normalize compiler-generated depfile paths Even though Makefile generators pass source files and include directories by absolute path to the compiler, the compiler may generate depfile paths relative to the current working directory. For example, `ccache` with `CCACHE_BASEDIR` may transform paths this way. When reading a depfile, convert relative dependencies to absolute paths before placing them in `compiler_depend.make`, which is later evaluated in the top-level build directory. Fixes: #22364 --- Source/cmDependsCompiler.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Source/cmDependsCompiler.cxx') diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index 2b48df9693..09f55997bf 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -131,7 +131,9 @@ bool cmDependsCompiler::CheckDependencies( depends.emplace_back(std::move(line)); } } else if (format == "gcc"_s) { - auto deps = cmReadGccDepfile(depFile.c_str()); + auto deps = cmReadGccDepfile( + depFile.c_str(), this->LocalGenerator->GetCurrentBinaryDirectory(), + GccDepfilePrependPaths::Deps); if (!deps) { continue; } -- cgit v1.2.1