From 09bee3bee137af72f57ee10327e4e5f689ce7e90 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 12 May 2021 15:50:22 -0400 Subject: [PATCH] cmGlobalGhsMultiGenerator: Simplify relative path conversion logic Our call to `MaybeConvertToRelativePath` uses paths that always pass the "maybe" checks. Use `ForceToRelativePath` directly. --- Source/cmGlobalGhsMultiGenerator.cxx | 8 ++++---- Source/cmGlobalGhsMultiGenerator.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 172cf3fc0c..7cf3e9363a 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -375,7 +375,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout, } void cmGlobalGhsMultiGenerator::WriteProjectLine( - std::ostream& fout, cmGeneratorTarget const* target, cmLocalGenerator* root, + std::ostream& fout, cmGeneratorTarget const* target, std::string& rootBinaryDir) { cmProp projName = target->GetProperty("GENERATOR_FILE_NAME"); @@ -383,7 +383,7 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine( if (projName && projType) { cmLocalGenerator* lg = target->GetLocalGenerator(); std::string dir = lg->GetCurrentBinaryDirectory(); - dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir); + dir = cmSystemTools::ForceToRelativePath(rootBinaryDir, dir); if (dir == ".") { dir.clear(); } else { @@ -433,7 +433,7 @@ void cmGlobalGhsMultiGenerator::WriteTargets(cmLocalGenerator* root) target->GetName(), "] had a cycle.\n")); } else { for (auto& tgt : build) { - this->WriteProjectLine(fbld, tgt, root, rootBinaryDir); + this->WriteProjectLine(fbld, tgt, rootBinaryDir); } } fbld.Close(); @@ -490,7 +490,7 @@ void cmGlobalGhsMultiGenerator::WriteAllTarget( target->GetType() == cmStateEnums::SHARED_LIBRARY) { continue; } - this->WriteProjectLine(fbld, target, root, rootBinaryDir); + this->WriteProjectLine(fbld, target, rootBinaryDir); } } fbld.Close(); diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 7753b311b7..bd08301fdf 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -103,7 +103,7 @@ private: void WriteSubProjects(std::ostream& fout, std::string& all_target); void WriteTargets(cmLocalGenerator* root); void WriteProjectLine(std::ostream& fout, cmGeneratorTarget const* target, - cmLocalGenerator* root, std::string& rootBinaryDir); + std::string& rootBinaryDir); void WriteCustomRuleBOD(std::ostream& fout); void WriteCustomTargetBOD(std::ostream& fout); void WriteAllTarget(cmLocalGenerator* root,