cmGlobalGhsMultiGenerator: Simplify relative path conversion logic

Our call to `MaybeConvertToRelativePath` uses paths that always pass the
"maybe" checks.  Use `ForceToRelativePath` directly.
This commit is contained in:
Brad King
2021-05-12 15:50:22 -04:00
parent f69079577a
commit 09bee3bee1
2 changed files with 5 additions and 5 deletions

View File

@@ -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();

View File

@@ -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,