summaryrefslogtreecommitdiff
path: root/Source/cmGhsMultiTargetGenerator.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/cmGhsMultiTargetGenerator.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/cmGhsMultiTargetGenerator.cxx')
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx8
1 files changed, 2 insertions, 6 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 9a17d07d7d..32238e4bd3 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -159,13 +159,11 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
const std::string& config)
{
std::string outpath;
- std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory();
if (this->TagType != GhsMultiGpj::SUBPROJECT) {
// set target binary file destination
outpath = this->GeneratorTarget->GetDirectory(config);
- outpath =
- this->LocalGenerator->MaybeConvertToRelativePath(rootpath, outpath);
+ outpath = this->LocalGenerator->MaybeRelativeToCurBinDir(outpath);
/* clang-format off */
fout << " :binDirRelative=\"" << outpath << "\"\n"
" -o \"" << this->TargetNameReal << "\"\n";
@@ -369,7 +367,6 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
// if the command specified a working directory use it.
std::string dir = this->LocalGenerator->GetCurrentBinaryDirectory();
- std::string currentBinDir = dir;
std::string workingDir = ccg.GetWorkingDirectory();
if (!workingDir.empty()) {
dir = workingDir;
@@ -427,8 +424,7 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
// working directory will be the start-output directory.
bool had_slash = cmd.find('/') != std::string::npos;
if (workingDir.empty()) {
- cmd =
- this->LocalGenerator->MaybeConvertToRelativePath(currentBinDir, cmd);
+ cmd = this->LocalGenerator->MaybeRelativeToCurBinDir(cmd);
}
bool has_slash = cmd.find('/') != std::string::npos;
if (had_slash && !has_slash) {