Commit 1825f876 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

Convert: Move access to BinaryDirectory out of loops

parent 25c39ac2
......@@ -239,20 +239,18 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// written by the original local generator for this directory
// convert the dependencies to paths relative to the home output
// directory. We must do the same here.
std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(), obj);
std::string binDir = this->LocalGenerator->GetBinaryDirectory();
std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
internalDepends << obj_i << std::endl;
for (std::set<std::string>::const_iterator i = dependencies.begin();
i != dependencies.end(); ++i) {
makeDepends << obj_m << ": "
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(), *i)
.c_str())
<< std::endl;
makeDepends
<< obj_m << ": "
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str())
<< std::endl;
internalDepends << " " << *i << std::endl;
}
makeDepends << std::endl;
......
......@@ -331,20 +331,18 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
const char* src = info.Source.c_str();
// Write the include dependencies to the output stream.
std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(), obj);
std::string binDir = this->LocalGenerator->GetBinaryDirectory();
std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj);
std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i.c_str());
internalDepends << obj_i << std::endl;
internalDepends << " " << src << std::endl;
for (std::set<std::string>::const_iterator i = info.Includes.begin();
i != info.Includes.end(); ++i) {
makeDepends << obj_m << ": "
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(
this->LocalGenerator->GetBinaryDirectory(), *i)
.c_str())
<< std::endl;
makeDepends
<< obj_m << ": "
<< cmSystemTools::ConvertToOutputPath(
this->LocalGenerator->ConvertToRelativePath(binDir, *i).c_str())
<< std::endl;
internalDepends << " " << *i << std::endl;
}
makeDepends << std::endl;
......@@ -370,10 +368,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += *i;
proxy += ".mod.proxy";
proxy = cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
proxy)
.c_str());
this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
// since we require some things add them to our list of requirements
makeDepends << obj_m << ".requires: " << proxy << std::endl;
......@@ -389,9 +384,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
if (!required->second.empty()) {
// This module is known. Depend on its timestamp file.
std::string stampFile = cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
required->second)
this->LocalGenerator->ConvertToRelativePath(binDir, required->second)
.c_str());
makeDepends << obj_m << ": " << stampFile << "\n";
} else {
......@@ -400,10 +393,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string module;
if (this->FindModule(*i, module)) {
module = cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
module)
.c_str());
this->LocalGenerator->ConvertToRelativePath(binDir, module).c_str());
makeDepends << obj_m << ": " << module << "\n";
}
}
......@@ -417,10 +407,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
proxy += *i;
proxy += ".mod.proxy";
proxy = cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
proxy)
.c_str());
this->LocalGenerator->ConvertToRelativePath(binDir, proxy).c_str());
makeDepends << proxy << ": " << obj_m << ".provides" << std::endl;
}
......@@ -468,10 +455,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
std::string driver = this->TargetDirectory;
driver += "/build";
driver = cmSystemTools::ConvertToOutputPath(
this->LocalGenerator
->ConvertToRelativePath(this->LocalGenerator->GetBinaryDirectory(),
driver)
.c_str());
this->LocalGenerator->ConvertToRelativePath(binDir, driver).c_str());
makeDepends << driver << ": " << obj_m << ".provides.build\n";
}
......
......@@ -581,12 +581,12 @@ void cmLocalUnixMakefileGenerator3::WriteMakeRule(
} else {
// Split dependencies into multiple rule lines. This allows for
// very long dependency lists even on older make implementations.
std::string binDir = this->GetBinaryDirectory();
for (std::vector<std::string>::const_iterator dep = depends.begin();
dep != depends.end(); ++dep) {
replace = *dep;
replace = cmSystemTools::ConvertToOutputPath(
this->ConvertToRelativePath(this->GetBinaryDirectory(), replace)
.c_str());
this->ConvertToRelativePath(binDir, replace).c_str());
os << cmMakeSafe(tgt) << space << ": " << cmMakeSafe(replace) << "\n";
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment