Convert: Move access to BinaryDirectory out of loops

This commit is contained in:
Stephen Kelly 2016-09-06 23:29:01 +02:00
parent 34c6e995f9
commit e13e519e1c
3 changed files with 7 additions and 11 deletions

View File

@ -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 = "";
} }

View File

@ -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 << " \"" cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, *k)
<< lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
*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 << " \"" cmakefileStream << " \"" << lg->ConvertToRelativePath(binDir, tmpStr)
<< lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
tmpStr)
<< "\"\n"; << "\"\n";
} }
cmakefileStream << " )\n\n"; cmakefileStream << " )\n\n";

View File

@ -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 << " \"" cmakefileStream << " \"" << this->ConvertToRelativePath(binaryDir, *i)
<< this->ConvertToRelativePath(
this->GetBinaryDirectory(), *i)
<< "\"\n"; << "\"\n";
} }
cmakefileStream << " )\n"; cmakefileStream << " )\n";