summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-12 19:51:47 (GMT)
committerBrad King <brad.king@kitware.com>2021-05-13 16:47:25 (GMT)
commit15fa3200715869d5acb94a282feb301d2e10a0eb (patch)
tree9c5d6c18b03b2917cc54d7fa2cfa5b9c89d8e4b0 /Source/cmLocalNinjaGenerator.cxx
parent1879f1bcbc4e2fbd9eaca4eff351ab928c4a3268 (diff)
downloadCMake-15fa3200715869d5acb94a282feb301d2e10a0eb.zip
CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.gz
CMake-15fa3200715869d5acb94a282feb301d2e10a0eb.tar.bz2
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/cmLocalNinjaGenerator.cxx')
-rw-r--r--Source/cmLocalNinjaGenerator.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 588f70b..475045a 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -60,8 +60,8 @@ void cmLocalNinjaGenerator::Generate()
{
// Compute the path to use when referencing the current output
// directory from the top output directory.
- this->HomeRelativeOutputPath = this->MaybeConvertToRelativePath(
- this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
+ this->HomeRelativeOutputPath =
+ this->MaybeRelativeToTopBinDir(this->GetCurrentBinaryDirectory());
if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath.clear();
}
@@ -213,9 +213,8 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
cmSystemTools::CollapseFullPath(path, this->GetCurrentBinaryDirectory()),
format);
}
- return this->ConvertToOutputFormat(
- this->MaybeConvertToRelativePath(this->GetBinaryDirectory(), path),
- format);
+ return this->ConvertToOutputFormat(this->MaybeRelativeToTopBinDir(path),
+ format);
}
// Private methods.
@@ -881,8 +880,7 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher(
if (!outputs.empty()) {
output = outputs[0];
if (ccg.GetWorkingDirectory().empty()) {
- output = this->MaybeConvertToRelativePath(
- this->GetCurrentBinaryDirectory(), output);
+ output = this->MaybeRelativeToCurBinDir(output);
}
output = this->ConvertToOutputFormat(output, cmOutputConverter::SHELL);
}