summaryrefslogtreecommitdiff
path: root/Source/cmDependsCompiler.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-12 15:51:47 -0400
committerBrad King <brad.king@kitware.com>2021-05-13 12:47:25 -0400
commit15fa3200715869d5acb94a282feb301d2e10a0eb (patch)
tree9c5d6c18b03b2917cc54d7fa2cfa5b9c89d8e4b0 /Source/cmDependsCompiler.cxx
parent1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268 (diff)
downloadcmake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.gz
cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work directories (e.g. top of the build tree) as the local path. Add helpers for each of the common cases to simplify and clarify call sites.
Diffstat (limited to 'Source/cmDependsCompiler.cxx')
-rw-r--r--Source/cmDependsCompiler.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx
index 2b48df9693..800725fd53 100644
--- a/Source/cmDependsCompiler.cxx
+++ b/Source/cmDependsCompiler.cxx
@@ -190,21 +190,19 @@ void cmDependsCompiler::WriteDependencies(
bool supportLongLineDepend = static_cast<cmGlobalUnixMakefileGenerator3*>(
this->LocalGenerator->GetGlobalGenerator())
->SupportsLongLineDependencies();
- const auto& binDir = this->LocalGenerator->GetBinaryDirectory();
cmDepends::DependencyMap makeDependencies(dependencies);
std::unordered_set<cm::string_view> phonyTargets;
// external dependencies file
for (auto& node : makeDependencies) {
auto target = this->LocalGenerator->ConvertToMakefilePath(
- this->LocalGenerator->MaybeConvertToRelativePath(binDir, node.first));
+ this->LocalGenerator->MaybeRelativeToTopBinDir(node.first));
auto& deps = node.second;
- std::transform(
- deps.cbegin(), deps.cend(), deps.begin(),
- [this, &binDir](const std::string& dep) {
- return this->LocalGenerator->ConvertToMakefilePath(
- this->LocalGenerator->MaybeConvertToRelativePath(binDir, dep));
- });
+ std::transform(deps.cbegin(), deps.cend(), deps.begin(),
+ [this](const std::string& dep) {
+ return this->LocalGenerator->ConvertToMakefilePath(
+ this->LocalGenerator->MaybeRelativeToTopBinDir(dep));
+ });
bool first_dep = true;
if (supportLongLineDepend) {