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 =
(*it)->GetGeneratorTargets();
std::string subdir = (*it)->ConvertToRelativePath(
(*it)->GetBinaryDirectory(), (*it)->GetCurrentBinaryDirectory());
this->HomeOutputDirectory, (*it)->GetCurrentBinaryDirectory());
if (subdir == ".") {
subdir = "";
}

View File

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

View File

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