Browse Source

Convert: Move access to BinaryDirectory out of loops

Stephen Kelly 9 years ago
parent
commit
e13e519e1c

+ 1 - 1
Source/cmExtraEclipseCDT4Generator.cxx

@@ -914,7 +914,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
     const std::vector<cmGeneratorTarget*> targets =
     const std::vector<cmGeneratorTarget*> targets =
       (*it)->GetGeneratorTargets();
       (*it)->GetGeneratorTargets();
     std::string subdir = (*it)->ConvertToRelativePath(
     std::string subdir = (*it)->ConvertToRelativePath(
-      (*it)->GetBinaryDirectory(), (*it)->GetCurrentBinaryDirectory());
+      this->HomeOutputDirectory, (*it)->GetCurrentBinaryDirectory());
     if (subdir == ".") {
     if (subdir == ".") {
       subdir = "";
       subdir = "";
     }
     }

+ 4 - 6
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -347,6 +347,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
                   << "\"\n";
                   << "\"\n";
   cmakefileStream << "  )\n\n";
   cmakefileStream << "  )\n\n";
 
 
+  const std::string binDir = lg->GetBinaryDirectory();
+
   // CMake must rerun if a byproduct is missing.
   // CMake must rerun if a byproduct is missing.
   {
   {
     cmakefileStream << "# Byproducts of CMake generate step:\n"
     cmakefileStream << "# Byproducts of CMake generate step:\n"
@@ -355,9 +357,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
       lg->GetMakefile()->GetOutputFiles();
       lg->GetMakefile()->GetOutputFiles();
     for (std::vector<std::string>::const_iterator k = outfiles.begin();
     for (std::vector<std::string>::const_iterator k = outfiles.begin();
          k != outfiles.end(); ++k) {
          k != outfiles.end(); ++k) {
-      cmakefileStream << "  \""
-                      << lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
-                                                   *k)
+      cmakefileStream << "  \"" << lg->ConvertToRelativePath(binDir, *k)
                       << "\"\n";
                       << "\"\n";
     }
     }
 
 
@@ -369,9 +369,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
       tmpStr = lg->GetCurrentBinaryDirectory();
       tmpStr = lg->GetCurrentBinaryDirectory();
       tmpStr += cmake::GetCMakeFilesDirectory();
       tmpStr += cmake::GetCMakeFilesDirectory();
       tmpStr += "/CMakeDirectoryInformation.cmake";
       tmpStr += "/CMakeDirectoryInformation.cmake";
-      cmakefileStream << "  \""
-                      << lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
-                                                   tmpStr)
+      cmakefileStream << "  \"" << lg->ConvertToRelativePath(binDir, tmpStr)
                       << "\"\n";
                       << "\"\n";
     }
     }
     cmakefileStream << "  )\n\n";
     cmakefileStream << "  )\n\n";

+ 2 - 4
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -1853,9 +1853,9 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
     const std::string& config =
     const std::string& config =
       this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
       this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
     this->GetIncludeDirectories(includes, target, l->first, config);
     this->GetIncludeDirectories(includes, target, l->first, config);
+    std::string binaryDir = this->GetState()->GetBinaryDirectory();
     if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
     if (this->Makefile->IsOn("CMAKE_DEPENDS_IN_PROJECT_ONLY")) {
       const char* sourceDir = this->GetState()->GetSourceDirectory();
       const char* sourceDir = this->GetState()->GetSourceDirectory();
-      const char* binaryDir = this->GetState()->GetBinaryDirectory();
       std::vector<std::string>::iterator itr =
       std::vector<std::string>::iterator itr =
         std::remove_if(includes.begin(), includes.end(),
         std::remove_if(includes.begin(), includes.end(),
                        ::NotInProjectDir(sourceDir, binaryDir));
                        ::NotInProjectDir(sourceDir, binaryDir));
@@ -1863,9 +1863,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
     }
     }
     for (std::vector<std::string>::iterator i = includes.begin();
     for (std::vector<std::string>::iterator i = includes.begin();
          i != includes.end(); ++i) {
          i != includes.end(); ++i) {
-      cmakefileStream << "  \""
-                      << this->ConvertToRelativePath(
-                           this->GetBinaryDirectory(), *i)
+      cmakefileStream << "  \"" << this->ConvertToRelativePath(binaryDir, *i)
                       << "\"\n";
                       << "\"\n";
     }
     }
     cmakefileStream << "  )\n";
     cmakefileStream << "  )\n";