diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 48a32f188..3296ffc35 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -239,20 +239,18 @@ bool cmDependsC::WriteDependencies(const std::set& 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::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 831753451..d7e2c332c 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::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 59dc4458b..6fd319e13 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::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"; } }