Browse Source

Convert: Inline HOME_OUTPUT MAKERULE conversion

Stephen Kelly 9 years ago
parent
commit
25c39ac28b

+ 5 - 3
Source/cmDependsC.cxx

@@ -247,9 +247,11 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
   for (std::set<std::string>::const_iterator i = dependencies.begin();
        i != dependencies.end(); ++i) {
     makeDepends << obj_m << ": "
-                << this->LocalGenerator->Convert(
-                     *i, cmOutputConverter::HOME_OUTPUT,
-                     cmOutputConverter::MAKERULE)
+                << cmSystemTools::ConvertToOutputPath(
+                     this->LocalGenerator
+                       ->ConvertToRelativePath(
+                         this->LocalGenerator->GetBinaryDirectory(), *i)
+                       .c_str())
                 << std::endl;
     internalDepends << " " << *i << std::endl;
   }

+ 30 - 14
Source/cmDependsFortran.cxx

@@ -339,9 +339,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
   for (std::set<std::string>::const_iterator i = info.Includes.begin();
        i != info.Includes.end(); ++i) {
     makeDepends << obj_m << ": "
-                << this->LocalGenerator->Convert(
-                     *i, cmOutputConverter::HOME_OUTPUT,
-                     cmOutputConverter::MAKERULE)
+                << cmSystemTools::ConvertToOutputPath(
+                     this->LocalGenerator
+                       ->ConvertToRelativePath(
+                         this->LocalGenerator->GetBinaryDirectory(), *i)
+                       .c_str())
                 << std::endl;
     internalDepends << " " << *i << std::endl;
   }
@@ -367,8 +369,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
       proxy += "/";
       proxy += *i;
       proxy += ".mod.proxy";
-      proxy = this->LocalGenerator->Convert(
-        proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+      proxy = cmSystemTools::ConvertToOutputPath(
+        this->LocalGenerator
+          ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                  proxy)
+          .c_str());
 
       // since we require some things add them to our list of requirements
       makeDepends << obj_m << ".requires: " << proxy << std::endl;
@@ -383,17 +388,22 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
     }
     if (!required->second.empty()) {
       // This module is known.  Depend on its timestamp file.
-      std::string stampFile = this->LocalGenerator->Convert(
-        required->second, cmOutputConverter::HOME_OUTPUT,
-        cmOutputConverter::MAKERULE);
+      std::string stampFile = cmSystemTools::ConvertToOutputPath(
+        this->LocalGenerator
+          ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                  required->second)
+          .c_str());
       makeDepends << obj_m << ": " << stampFile << "\n";
     } else {
       // This module is not known to CMake.  Try to locate it where
       // the compiler will and depend on that.
       std::string module;
       if (this->FindModule(*i, module)) {
-        module = this->LocalGenerator->Convert(
-          module, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+        module = cmSystemTools::ConvertToOutputPath(
+          this->LocalGenerator
+            ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                    module)
+            .c_str());
         makeDepends << obj_m << ": " << module << "\n";
       }
     }
@@ -406,8 +416,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
     proxy += "/";
     proxy += *i;
     proxy += ".mod.proxy";
-    proxy = this->LocalGenerator->Convert(
-      proxy, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+    proxy = cmSystemTools::ConvertToOutputPath(
+      this->LocalGenerator
+        ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                proxy)
+        .c_str());
     makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
   }
 
@@ -454,8 +467,11 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
     // the target finishes building.
     std::string driver = this->TargetDirectory;
     driver += "/build";
-    driver = this->LocalGenerator->Convert(
-      driver, cmOutputConverter::HOME_OUTPUT, cmOutputConverter::MAKERULE);
+    driver = cmSystemTools::ConvertToOutputPath(
+      this->LocalGenerator
+        ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                driver)
+        .c_str());
     makeDepends << driver << ": " << obj_m << ".provides.build\n";
   }
 

+ 4 - 3
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -480,9 +480,10 @@ void cmGlobalUnixMakefileGenerator3::WriteDirectoryRules2(
   }
 
   // Begin the directory-level rules section.
-  std::string dir = lg->GetCurrentBinaryDirectory();
-  dir = lg->Convert(dir, cmOutputConverter::HOME_OUTPUT,
-                    cmOutputConverter::MAKERULE);
+  std::string dir = cmSystemTools::ConvertToOutputPath(
+    lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
+                              lg->GetCurrentBinaryDirectory())
+      .c_str());
   lg->WriteDivider(ruleFileStream);
   ruleFileStream << "# Directory level rules for directory " << dir << "\n\n";
 

+ 5 - 4
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -556,8 +556,8 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
   }
 
   // Construct the left hand side of the rule.
-  std::string tgt = this->Convert(target, cmOutputConverter::HOME_OUTPUT,
-                                  cmOutputConverter::MAKERULE);
+  std::string tgt = cmSystemTools::ConvertToOutputPath(
+    this->ConvertToRelativePath(this->GetBinaryDirectory(), target).c_str());
 
   const char* space = "";
   if (tgt.size() == 1) {
@@ -584,8 +584,9 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
     for (std::vector<std::string>::const_iterator dep = depends.begin();
          dep != depends.end(); ++dep) {
       replace = *dep;
-      replace = this->Convert(replace, cmOutputConverter::HOME_OUTPUT,
-                              cmOutputConverter::MAKERULE);
+      replace = cmSystemTools::ConvertToOutputPath(
+        this->ConvertToRelativePath(this->GetBinaryDirectory(), replace)
+          .c_str());
       os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
     }
   }

+ 16 - 7
Source/cmMakefileTargetGenerator.cxx

@@ -216,8 +216,11 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
   *this->BuildFileStream
     << "# Include any dependencies generated for this target.\n"
     << this->GlobalGenerator->IncludeDirective << " " << root
-    << this->Convert(dependFileNameFull, cmOutputConverter::HOME_OUTPUT,
-                     cmOutputConverter::MAKERULE)
+    << cmSystemTools::ConvertToOutputPath(
+         this->LocalGenerator
+           ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                   dependFileNameFull)
+           .c_str())
     << "\n\n";
 
   if (!this->NoRuleMessages) {
@@ -225,9 +228,12 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
     *this->BuildFileStream
       << "# Include the progress variables for this target.\n"
       << this->GlobalGenerator->IncludeDirective << " " << root
-      << this->Convert(this->ProgressFileNameFull,
-                       cmOutputConverter::HOME_OUTPUT,
-                       cmOutputConverter::MAKERULE)
+      << cmSystemTools::ConvertToOutputPath(
+           this->LocalGenerator
+             ->ConvertToRelativePath(
+               this->LocalGenerator->GetBinaryDirectory(),
+               this->ProgressFileNameFull)
+             .c_str())
       << "\n\n";
   }
 
@@ -257,8 +263,11 @@ void cmMakefileTargetGenerator::WriteCommonCodeRules()
   *this->BuildFileStream
     << "# Include the compile flags for this target's objects.\n"
     << this->GlobalGenerator->IncludeDirective << " " << root
-    << this->Convert(this->FlagFileNameFull, cmOutputConverter::HOME_OUTPUT,
-                     cmOutputConverter::MAKERULE)
+    << cmSystemTools::ConvertToOutputPath(
+         this->LocalGenerator
+           ->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
+                                   this->FlagFileNameFull)
+           .c_str())
     << "\n\n";
 }
 

+ 6 - 3
Source/cmMakefileUtilityTargetGenerator.cxx

@@ -53,9 +53,12 @@ void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
     *this->BuildFileStream
       << "# Include the progress variables for this target.\n"
       << this->GlobalGenerator->IncludeDirective << " " << root
-      << this->Convert(this->ProgressFileNameFull,
-                       cmOutputConverter::HOME_OUTPUT,
-                       cmOutputConverter::MAKERULE)
+      << cmSystemTools::ConvertToOutputPath(
+           this->LocalGenerator
+             ->ConvertToRelativePath(
+               this->LocalGenerator->GetBinaryDirectory(),
+               this->ProgressFileNameFull)
+             .c_str())
       << "\n\n";
   }