diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-09-07 21:14:30 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-09-19 19:36:13 (GMT) |
commit | 1825f876a7467a97b1cb3f6dd60f95c173d9e61b (patch) | |
tree | 0d70f9ac13c2886f0ec77e2156956b05c7067e3e | |
parent | 25c39ac28b42234d08c3906ce24ac739f6111506 (diff) | |
download | CMake-1825f876a7467a97b1cb3f6dd60f95c173d9e61b.zip CMake-1825f876a7467a97b1cb3f6dd60f95c173d9e61b.tar.gz CMake-1825f876a7467a97b1cb3f6dd60f95c173d9e61b.tar.bz2 |
Convert: Move access to BinaryDirectory out of loops
-rw-r--r-- | Source/cmDependsC.cxx | 16 | ||||
-rw-r--r-- | Source/cmDependsFortran.cxx | 40 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 4 |
3 files changed, 21 insertions, 39 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 48a32f1..3296ffc 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -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; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 8317534..d7e2c33 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -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"; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 59dc445..6fd319e 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -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"; } } |