Browse Source

cmGlobalGhsMultiGenerator: Simplify relative path conversion logic

Our call to `MaybeConvertToRelativePath` uses paths that always pass the
"maybe" checks.  Use `ForceToRelativePath` directly.
Brad King 4 years ago
parent
commit
09bee3bee1
2 changed files with 5 additions and 5 deletions
  1. 4 4
      Source/cmGlobalGhsMultiGenerator.cxx
  2. 1 1
      Source/cmGlobalGhsMultiGenerator.h

+ 4 - 4
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();

+ 1 - 1
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,