소스 검색

ENH: Converted some ConvertToRelativeOutputPath calls to ConvertToOptionallyRelativeOutputPath in preparation for making ConvertToRelativeOutputPath always convert. Some of these might be able to be switched back but we will first have to test what paths can be relative in the generate VS project files.

Brad King 20 년 전
부모
커밋
397dc1cef5
2개의 변경된 파일20개의 추가작업 그리고 30개의 파일을 삭제
  1. 17 22
      Source/cmLocalVisualStudio6Generator.cxx
  2. 3 8
      Source/cmLocalVisualStudio7Generator.cxx

+ 17 - 22
Source/cmLocalVisualStudio6Generator.cxx

@@ -61,7 +61,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
   for(i = includes.begin(); i != includes.end(); ++i)
   for(i = includes.begin(); i != includes.end(); ++i)
     {
     {
     m_IncludeOptions +=  " /I ";
     m_IncludeOptions +=  " /I ";
-    std::string tmp = this->ConvertToRelativeOutputPath(i->c_str());
+    std::string tmp = this->ConvertToOptionallyRelativeOutputPath(i->c_str());
 
 
     // quote if not already quoted
     // quote if not already quoted
     if (tmp[0] != '"')
     if (tmp[0] != '"')
@@ -163,15 +163,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule()
 {
 {
   std::string dspname = *(m_CreatedProjectNames.end()-1);
   std::string dspname = *(m_CreatedProjectNames.end()-1);
   dspname += ".dsp.cmake";
   dspname += ".dsp.cmake";
-  std::string makefileIn = m_Makefile->GetStartDirectory();
-  makefileIn += "/";
-  makefileIn += "CMakeLists.txt";
-  makefileIn = this->ConvertToRelativeOutputPath(makefileIn.c_str());
   const char* dsprule = m_Makefile->GetRequiredDefinition("CMAKE_COMMAND");
   const char* dsprule = m_Makefile->GetRequiredDefinition("CMAKE_COMMAND");
   cmCustomCommandLine commandLine;
   cmCustomCommandLine commandLine;
   commandLine.push_back(dsprule);
   commandLine.push_back(dsprule);
-  commandLine.push_back(makefileIn);
-  makefileIn = m_Makefile->GetStartDirectory();
+  std::string makefileIn = m_Makefile->GetStartDirectory();
   makefileIn += "/";
   makefileIn += "/";
   makefileIn += "CMakeLists.txt";
   makefileIn += "CMakeLists.txt";
   std::string args;
   std::string args;
@@ -357,7 +352,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
         // Tell MS-Dev what the source is.  If the compiler knows how to
         // Tell MS-Dev what the source is.  If the compiler knows how to
         // build it, then it will.
         // build it, then it will.
         fout << "SOURCE=" << 
         fout << "SOURCE=" << 
-          this->ConvertToRelativeOutputPath(source.c_str()) << "\n\n";
+          this->ConvertToOptionallyRelativeOutputPath(source.c_str()) << "\n\n";
         if(!depends.empty())
         if(!depends.empty())
           {
           {
           // Write out the dependencies for the rule.
           // Write out the dependencies for the rule.
@@ -366,7 +361,7 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
               d != depends.end(); ++d)
               d != depends.end(); ++d)
             { 
             { 
             fout << "\\\n\t" << 
             fout << "\\\n\t" << 
-              this->ConvertToRelativeOutputPath(d->c_str());
+              this->ConvertToOptionallyRelativeOutputPath(d->c_str());
             }
             }
           fout << "\n";
           fout << "\n";
           }
           }
@@ -470,12 +465,12 @@ void cmLocalVisualStudio6Generator::WriteCustomRule(std::ostream& fout,
         libPath += dep;
         libPath += dep;
         libPath += ".exe";
         libPath += ".exe";
         fout << "\\\n\t" << 
         fout << "\\\n\t" << 
-          this->ConvertToRelativeOutputPath(libPath.c_str());
+          this->ConvertToOptionallyRelativeOutputPath(libPath.c_str());
         }
         }
       else
       else
         {
         {
         fout << "\\\n\t" << 
         fout << "\\\n\t" << 
-          this->ConvertToRelativeOutputPath(d->c_str());
+          this->ConvertToOptionallyRelativeOutputPath(d->c_str());
         }
         }
       }
       }
     fout << "\n";
     fout << "\n";
@@ -490,7 +485,7 @@ void cmLocalVisualStudio6Generator::WriteCustomRule(std::ostream& fout,
       }
       }
     
     
     // Write a rule for every output generated by this command.
     // Write a rule for every output generated by this command.
-    fout << this->ConvertToRelativeOutputPath(output)
+    fout << this->ConvertToOptionallyRelativeOutputPath(output)
          << " :  \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
          << " :  \"$(SOURCE)\" \"$(INTDIR)\" \"$(OUTDIR)\"\n\t";
     fout << command << "\n\n";
     fout << command << "\n\n";
     fout << "# End Custom Build\n\n";
     fout << "# End Custom Build\n\n";
@@ -722,13 +717,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
       libPath += "/";
       libPath += "/";
       }
       }
     std::string lpath = 
     std::string lpath = 
-      this->ConvertToRelativeOutputPath(libPath.c_str());
+      this->ConvertToOptionallyRelativeOutputPath(libPath.c_str());
     if(lpath.size() == 0)
     if(lpath.size() == 0)
       {
       {
       lpath = ".";
       lpath = ".";
       }
       }
     std::string lpathIntDir = libPath + "$(INTDIR)";
     std::string lpathIntDir = libPath + "$(INTDIR)";
-    lpathIntDir =  this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
+    lpathIntDir =  this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
     if(pathEmitted.insert(lpath).second)
     if(pathEmitted.insert(lpath).second)
       {
       {
       libOptions += " /LIBPATH:";
       libOptions += " /LIBPATH:";
@@ -759,13 +754,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
       exePath += "/";
       exePath += "/";
       }
       }
     std::string lpath = 
     std::string lpath = 
-      this->ConvertToRelativeOutputPath(exePath.c_str());
+      this->ConvertToOptionallyRelativeOutputPath(exePath.c_str());
     if(lpath.size() == 0)
     if(lpath.size() == 0)
       {
       {
       lpath = ".";
       lpath = ".";
       }
       }
     std::string lpathIntDir = exePath + "$(INTDIR)";
     std::string lpathIntDir = exePath + "$(INTDIR)";
-    lpathIntDir =  this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
+    lpathIntDir =  this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
     
     
     if(pathEmitted.insert(lpath).second)
     if(pathEmitted.insert(lpath).second)
       {
       {
@@ -799,13 +794,13 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
       path += "/";
       path += "/";
       }
       }
     std::string lpath = 
     std::string lpath = 
-      this->ConvertToRelativeOutputPath(path.c_str());
+      this->ConvertToOptionallyRelativeOutputPath(path.c_str());
     if(lpath.size() == 0)
     if(lpath.size() == 0)
       {
       {
       lpath = ".";
       lpath = ".";
       }
       }
     std::string lpathIntDir = path + "$(INTDIR)";
     std::string lpathIntDir = path + "$(INTDIR)";
-    lpathIntDir =  this->ConvertToRelativeOutputPath(lpathIntDir.c_str());
+    lpathIntDir =  this->ConvertToOptionallyRelativeOutputPath(lpathIntDir.c_str());
     if(pathEmitted.insert(lpath).second)
     if(pathEmitted.insert(lpath).second)
       {
       {
       libOptions += " /LIBPATH:";
       libOptions += " /LIBPATH:";
@@ -858,8 +853,8 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
         lib += ".lib";
         lib += ".lib";
         libDebug += ".lib";
         libDebug += ".lib";
         }
         }
-      lib = this->ConvertToRelativeOutputPath(lib.c_str());
-      libDebug = this->ConvertToRelativeOutputPath(libDebug.c_str());
+      lib = this->ConvertToOptionallyRelativeOutputPath(lib.c_str());
+      libDebug = this->ConvertToOptionallyRelativeOutputPath(libDebug.c_str());
       
       
       if (j->second == cmTarget::GENERAL)
       if (j->second == cmTarget::GENERAL)
         {
         {
@@ -1024,10 +1019,10 @@ void cmLocalVisualStudio6Generator::WriteDSPHeader(std::ostream& fout, const cha
     // to convert to output path for unix to win32 conversion
     // to convert to output path for unix to win32 conversion
     cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
     cmSystemTools::ReplaceString(line, "LIBRARY_OUTPUT_PATH",
                                  removeQuotes(
                                  removeQuotes(
-                                   this->ConvertToRelativeOutputPath(libPath.c_str())).c_str());
+                                   this->ConvertToOptionallyRelativeOutputPath(libPath.c_str())).c_str());
     cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
     cmSystemTools::ReplaceString(line, "EXECUTABLE_OUTPUT_PATH",
                                  removeQuotes(
                                  removeQuotes(
-                                   this->ConvertToRelativeOutputPath(exePath.c_str())).c_str());
+                                   this->ConvertToOptionallyRelativeOutputPath(exePath.c_str())).c_str());
     cmSystemTools::ReplaceString(line, 
     cmSystemTools::ReplaceString(line, 
                                  "EXTRA_DEFINES", 
                                  "EXTRA_DEFINES", 
                                  m_Makefile->GetDefineFlags());
                                  m_Makefile->GetDefineFlags());

+ 3 - 8
Source/cmLocalVisualStudio7Generator.cxx

@@ -135,15 +135,10 @@ void cmLocalVisualStudio7Generator::AddVCProjBuildRule()
 {
 {
   std::string dspname = *(m_CreatedProjectNames.end()-1);
   std::string dspname = *(m_CreatedProjectNames.end()-1);
   dspname += ".vcproj.cmake";
   dspname += ".vcproj.cmake";
-  std::string makefileIn = m_Makefile->GetStartDirectory();
-  makefileIn += "/";
-  makefileIn += "CMakeLists.txt";
-  makefileIn = this->ConvertToRelativeOutputPath(makefileIn.c_str());
   const char* dsprule = m_Makefile->GetRequiredDefinition("CMAKE_COMMAND");
   const char* dsprule = m_Makefile->GetRequiredDefinition("CMAKE_COMMAND");
   cmCustomCommandLine commandLine;
   cmCustomCommandLine commandLine;
   commandLine.push_back(dsprule);
   commandLine.push_back(dsprule);
-  commandLine.push_back(makefileIn);
-  makefileIn = m_Makefile->GetStartDirectory();
+  std::string makefileIn = m_Makefile->GetStartDirectory();
   makefileIn += "/";
   makefileIn += "/";
   makefileIn += "CMakeLists.txt";
   makefileIn += "CMakeLists.txt";
   std::string args;
   std::string args;
@@ -1317,7 +1312,7 @@ std::string cmLocalVisualStudio7Generator::EscapeForXML(const char* s)
 
 
 std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* path)
 std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* path)
 {
 {
-  std::string ret = this->ConvertToRelativeOutputPath(path);
+  std::string ret = this->ConvertToOptionallyRelativeOutputPath(path);
   cmSystemTools::ReplaceString(ret, "&", "&amp;");
   cmSystemTools::ReplaceString(ret, "&", "&amp;");
   cmSystemTools::ReplaceString(ret, "\"", "&quot;");
   cmSystemTools::ReplaceString(ret, "\"", "&quot;");
   cmSystemTools::ReplaceString(ret, "<", "&lt;");
   cmSystemTools::ReplaceString(ret, "<", "&lt;");
@@ -1327,7 +1322,7 @@ std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPath(const char* pa
 
 
 std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const char* path)
 std::string cmLocalVisualStudio7Generator::ConvertToXMLOutputPathSingle(const char* path)
 {
 {
-  std::string ret = this->ConvertToRelativeOutputPath(path);
+  std::string ret = this->ConvertToOptionallyRelativeOutputPath(path);
   cmSystemTools::ReplaceString(ret, "\"", "");
   cmSystemTools::ReplaceString(ret, "\"", "");
   cmSystemTools::ReplaceString(ret, "&", "&amp;");
   cmSystemTools::ReplaceString(ret, "&", "&amp;");
   cmSystemTools::ReplaceString(ret, "<", "&lt;");
   cmSystemTools::ReplaceString(ret, "<", "&lt;");