diff options
author | Brad King <brad.king@kitware.com> | 2021-07-02 14:01:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-07-02 14:01:09 (GMT) |
commit | 6bc6ffb9a9b32e07d7cdf8532ba0f49c8153d15c (patch) | |
tree | 3eb82ae438145021d965a1363eef7ee6956afb64 /Source | |
parent | 6372e74ed4808f9cb6f2385cc4d8325e22a9fdb6 (diff) | |
parent | 6a6efdcaedc6f87fbafd40af5305cabdced450c4 (diff) | |
download | CMake-6bc6ffb9a9b32e07d7cdf8532ba0f49c8153d15c.zip CMake-6bc6ffb9a9b32e07d7cdf8532ba0f49c8153d15c.tar.gz CMake-6bc6ffb9a9b32e07d7cdf8532ba0f49c8153d15c.tar.bz2 |
Merge branch 'backport-3.20-makefile-normalize-depfile'
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmDependsCompiler.cxx | 4 | ||||
-rw-r--r-- | Source/cmGccDepfileReader.cxx | 8 | ||||
-rw-r--r-- | Source/cmGccDepfileReader.h | 11 |
3 files changed, 17 insertions, 6 deletions
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index 800725f..bf599ff 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; } diff --git a/Source/cmGccDepfileReader.cxx b/Source/cmGccDepfileReader.cxx index 6436baa..d30dbc3 100644 --- a/Source/cmGccDepfileReader.cxx +++ b/Source/cmGccDepfileReader.cxx @@ -12,8 +12,9 @@ #include "cmStringAlgorithms.h" #include "cmSystemTools.h" -cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath, - const std::string& prefix) +cm::optional<cmGccDepfileContent> cmReadGccDepfile( + const char* filePath, const std::string& prefix, + GccDepfilePrependPaths prependPaths) { cmGccDepfileLexerHelper helper; if (!helper.readFile(filePath)) { @@ -23,7 +24,8 @@ cm::optional<cmGccDepfileContent> cmReadGccDepfile(const char* filePath, for (auto& dep : *deps) { for (auto& rule : dep.rules) { - if (!prefix.empty() && !cmSystemTools::FileIsFullPath(rule)) { + if (prependPaths == GccDepfilePrependPaths::All && !prefix.empty() && + !cmSystemTools::FileIsFullPath(rule)) { rule = cmStrCat(prefix, '/', rule); } if (cmSystemTools::FileIsFullPath(rule)) { diff --git a/Source/cmGccDepfileReader.h b/Source/cmGccDepfileReader.h index c8a3748..2433492 100644 --- a/Source/cmGccDepfileReader.h +++ b/Source/cmGccDepfileReader.h @@ -8,8 +8,15 @@ #include "cmGccDepfileReaderTypes.h" +enum class GccDepfilePrependPaths +{ + All, + Deps, +}; + /* - * Read dependencies file and append prefix to all relative paths + * Read dependencies file and prepend prefix to all relative paths */ cm::optional<cmGccDepfileContent> cmReadGccDepfile( - const char* filePath, const std::string& prefix = {}); + const char* filePath, const std::string& prefix = {}, + GccDepfilePrependPaths prependPaths = GccDepfilePrependPaths::All); |