Browse Source

cmLocalGenerator: Remove 'optional' parameter from Convert.

Port callers away from it.
Stephen Kelly 10 years ago
parent
commit
6e570f857a

+ 2 - 6
Source/cmGlobalVisualStudio8Generator.cxx

@@ -310,14 +310,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
   cmCustomCommandLine commandLine;
   commandLine.push_back(cmSystemTools::GetCMakeCommand());
   std::string argH = "-H";
-  argH += lg->Convert(mf->GetHomeDirectory(),
-                      cmLocalGenerator::START_OUTPUT,
-                      cmLocalGenerator::UNCHANGED, true);
+  argH += mf->GetHomeDirectory();
   commandLine.push_back(argH);
   std::string argB = "-B";
-  argB += lg->Convert(mf->GetHomeOutputDirectory(),
-                      cmLocalGenerator::START_OUTPUT,
-                      cmLocalGenerator::UNCHANGED, true);
+  argB += mf->GetHomeOutputDirectory();
   commandLine.push_back(argB);
   commandLine.push_back("--check-stamp-list");
   commandLine.push_back(stampList.c_str());

+ 35 - 38
Source/cmLocalGenerator.cxx

@@ -517,7 +517,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
   objectDir = this->Convert(objectDir,START_OUTPUT,SHELL);
   std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
   std::string sourceFile =
-    this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true);
+      this->ConvertToOutputFormat(source.GetFullPath(), SHELL);
   std::string varString = "CMAKE_";
   varString += lang;
   varString += "_COMPILE_OBJECT";
@@ -1177,7 +1177,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
     std::string tmp;
     if(cmSystemTools::GetShortPath(remote, tmp))
       {
-      return this->Convert(tmp, NONE, format, true);
+      return this->ConvertToOutputFormat(tmp, format);
       }
     }
 
@@ -1191,8 +1191,10 @@ cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote,
                                              RelativeRoot local,
                                              OutputFormat format)
 {
+  static_cast<void>(local);
+
   // Perform standard conversion.
-  std::string result = this->Convert(remote, local, format, true);
+  std::string result = this->ConvertToOutputFormat(remote, format);
 
   // Consider short-path.
   return this->ConvertToOutputForExistingCommon(remote, result, format);
@@ -1311,8 +1313,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
           {
           includeFlags << fwSearchFlag;
           }
-        includeFlags << this->Convert(frameworkDir, START_OUTPUT,
-                                      shellFormat, true)
+        includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat)
           << " ";
         }
       continue;
@@ -2686,42 +2687,39 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::Convert(const std::string& source,
                                       RelativeRoot relative,
-                                      OutputFormat output,
-                                      bool optional)
+                                      OutputFormat output)
 {
   // Convert the path to a relative path.
   std::string result = source;
 
-  if (!optional)
+  switch (relative)
     {
-    switch (relative)
-      {
-      case HOME:
-        //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->GetState()->GetSourceDirectoryComponents(), result);
-        break;
-      case START:
-        //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
-        break;
-      case HOME_OUTPUT:
-        //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->GetState()->GetBinaryDirectoryComponents(), result);
-        break;
-      case START_OUTPUT:
-        //result = cmSystemTools::CollapseFullPath(result.c_str());
-        result = this->ConvertToRelativePath(
-            this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
-        break;
-      case FULL:
-        result = cmSystemTools::CollapseFullPath(result);
-        break;
-      case NONE:
-        break;
-      }
+    case HOME:
+      //result = cmSystemTools::CollapseFullPath(result.c_str());
+      result = this->ConvertToRelativePath(
+          this->GetState()->GetSourceDirectoryComponents(), result);
+      break;
+    case START:
+      //result = cmSystemTools::CollapseFullPath(result.c_str());
+      result = this->ConvertToRelativePath(
+          this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
+      break;
+    case HOME_OUTPUT:
+      //result = cmSystemTools::CollapseFullPath(result.c_str());
+      result = this->ConvertToRelativePath(
+          this->GetState()->GetBinaryDirectoryComponents(), result);
+      break;
+    case START_OUTPUT:
+      //result = cmSystemTools::CollapseFullPath(result.c_str());
+      result = this->ConvertToRelativePath(
+          this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
+      break;
+    case FULL:
+      result = cmSystemTools::CollapseFullPath(result);
+      break;
+    case NONE:
+      break;
+
     }
   return this->ConvertToOutputFormat(result, output);
 }
@@ -2765,8 +2763,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
 //----------------------------------------------------------------------------
 std::string cmLocalGenerator::Convert(RelativeRoot remote,
                                       const std::string& local,
-                                      OutputFormat output,
-                                      bool optional)
+                                      OutputFormat output, bool optional)
 {
   const char* remotePath = this->GetRelativeRootPath(remote);
 

+ 1 - 2
Source/cmLocalGenerator.h

@@ -115,8 +115,7 @@ public:
   std::string ConvertToOutputFormat(const std::string& source,
                                     OutputFormat output);
   std::string Convert(const std::string& remote, RelativeRoot local,
-                      OutputFormat output = UNCHANGED,
-                      bool optional = false);
+                      OutputFormat output = UNCHANGED);
   std::string Convert(RelativeRoot remote, const std::string& local,
                       OutputFormat output = UNCHANGED,
                       bool optional = false);

+ 2 - 5
Source/cmLocalVisualStudio6Generator.cxx

@@ -235,13 +235,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
   comment += makefileIn;
   std::string args;
   args = "-H";
-  args += this->Convert(this->Makefile->GetHomeDirectory(),
-                        START_OUTPUT, UNCHANGED, true);
+  args += this->Makefile->GetHomeDirectory();
   commandLine.push_back(args);
   args = "-B";
-  args +=
-    this->Convert(this->Makefile->GetHomeOutputDirectory(),
-                  START_OUTPUT, UNCHANGED, true);
+  args += this->Makefile->GetHomeOutputDirectory();
   commandLine.push_back(args);
 
   std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();

+ 2 - 5
Source/cmLocalVisualStudio7Generator.cxx

@@ -305,13 +305,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
   comment += makefileIn;
   std::string args;
   args = "-H";
-  args += this->Convert(this->Makefile->GetHomeDirectory(),
-                        START_OUTPUT, UNCHANGED, true);
+  args += this->Makefile->GetHomeDirectory();
   commandLine.push_back(args);
   args = "-B";
-  args +=
-    this->Convert(this->Makefile->GetHomeOutputDirectory(),
-                  START_OUTPUT, UNCHANGED, true);
+  args += this->Makefile->GetHomeOutputDirectory();
   commandLine.push_back(args);
   commandLine.push_back("--check-stamp-file");
   std::string stampFilename = this->Convert(stampName.c_str(), FULL,

+ 2 - 3
Source/cmMakefileTargetGenerator.cxx

@@ -1589,9 +1589,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
       if(emitted.insert(*i).second)
         {
         flags += fwSearchFlag;
-        flags += this->Convert(*i,
-                               cmLocalGenerator::START_OUTPUT,
-                               cmLocalGenerator::SHELL, true);
+        flags += this->LocalGenerator
+                     ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL);
         flags += " ";
         }
       }

+ 2 - 3
Source/cmMakefileTargetGenerator.h

@@ -273,10 +273,9 @@ protected:
   std::string Convert(const std::string& source,
                       cmLocalGenerator::RelativeRoot relative,
                       cmLocalGenerator::OutputFormat output =
-                      cmLocalGenerator::UNCHANGED,
-                      bool optional = false)
+                      cmLocalGenerator::UNCHANGED)
   {
-    return this->LocalGenerator->Convert(source, relative, output, optional);
+    return this->LocalGenerator->Convert(source, relative, output);
   }
 
 };

+ 1 - 4
Source/cmVisualStudio10TargetGenerator.cxx

@@ -923,10 +923,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path,
   return forceRelative
     ? cmSystemTools::RelativePath(
       this->Makefile->GetCurrentBinaryDirectory(), path.c_str())
-    : this->LocalGenerator->Convert(path.c_str(),
-                                    cmLocalGenerator::START_OUTPUT,
-                                    cmLocalGenerator::UNCHANGED,
-                                    /* optional = */ true);
+    : path.c_str();
 }
 
 void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)