From 34c6e995f9ac1c62540b68dd50934c8c0be98b7f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 6 Sep 2016 23:02:23 +0200 Subject: [PATCH] Convert: Avoid HOME_OUTPUT enum when converting to relative paths --- Source/cmDependsC.cxx | 2 +- Source/cmDependsFortran.cxx | 2 +- Source/cmExtraEclipseCDT4Generator.cxx | 2 +- Source/cmGlobalGenerator.cxx | 2 +- Source/cmGlobalNinjaGenerator.cxx | 4 ++-- Source/cmGlobalUnixMakefileGenerator3.cxx | 11 ++++++----- Source/cmLocalNinjaGenerator.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 6 +++--- Source/cmMakefileTargetGenerator.cxx | 4 ++-- 9 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index fbbf42f65..bc71aac6a 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -240,7 +240,7 @@ bool cmDependsC::WriteDependencies(const std::set& sources, // convert the dependencies to paths relative to the home output // directory. We must do the same here. std::string obj_i = this->LocalGenerator->ConvertToRelativePath( - obj, cmOutputConverter::HOME_OUTPUT); + this->LocalGenerator->GetBinaryDirectory(), obj); std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( obj_i, cmOutputConverter::MAKERULE); internalDepends << obj_i << std::endl; diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index 44592bbe5..925e38514 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -332,7 +332,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj, // Write the include dependencies to the output stream. std::string obj_i = this->LocalGenerator->ConvertToRelativePath( - obj, cmOutputConverter::HOME_OUTPUT); + this->LocalGenerator->GetBinaryDirectory(), obj); std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( obj_i, cmOutputConverter::MAKERULE); internalDepends << obj_i << std::endl; diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 5a98e3482..d1be0c767 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -914,7 +914,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const const std::vector targets = (*it)->GetGeneratorTargets(); std::string subdir = (*it)->ConvertToRelativePath( - (*it)->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); + (*it)->GetBinaryDirectory(), (*it)->GetCurrentBinaryDirectory()); if (subdir == ".") { subdir = ""; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ed7345040..4772474b0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2579,7 +2579,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector& outputs, // Shorten the output name (in expected use case). cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot()); std::string fname = converter.ConvertToRelativePath( - outputs[0], cmOutputConverter::HOME_OUTPUT); + this->GetMakefiles()[0]->GetState()->GetBinaryDirectory(), outputs[0]); // Associate the hash with this output. this->RuleHashes[fname] = hash; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 7e343c913..bd65366da 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -760,8 +760,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path) { cmLocalNinjaGenerator* ng = static_cast(this->LocalGenerators[0]); - std::string convPath = - ng->ConvertToRelativePath(path, cmOutputConverter::HOME_OUTPUT); + std::string convPath = ng->ConvertToRelativePath( + this->LocalGenerators[0]->GetState()->GetBinaryDirectory(), path); convPath = this->NinjaOutputPath(convPath); #ifdef _WIN32 std::replace(convPath.begin(), convPath.end(), '/', '\\'); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index caf71fdda..54383752c 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -356,8 +356,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() for (std::vector::const_iterator k = outfiles.begin(); k != outfiles.end(); ++k) { cmakefileStream << " \"" - << lg->ConvertToRelativePath( - *k, cmOutputConverter::HOME_OUTPUT) + << lg->ConvertToRelativePath(lg->GetBinaryDirectory(), + *k) << "\"\n"; } @@ -370,8 +370,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += "/CMakeDirectoryInformation.cmake"; cmakefileStream << " \"" - << lg->ConvertToRelativePath( - tmpStr, cmOutputConverter::HOME_OUTPUT) + << lg->ConvertToRelativePath(lg->GetBinaryDirectory(), + tmpStr) << "\"\n"; } cmakefileStream << " )\n\n"; @@ -532,7 +532,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand( tname += "/fast"; } cmOutputConverter conv(mf->GetStateSnapshot()); - tname = conv.ConvertToRelativePath(tname, cmOutputConverter::HOME_OUTPUT); + tname = + conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(tname); if (this->Makefiles.empty()) { diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 6793f8450..f651c6e88 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -51,7 +51,7 @@ void cmLocalNinjaGenerator::Generate() // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = this->ConvertToRelativePath( - this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); + this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; } diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 9d3567e9e..6d2dac249 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -151,7 +151,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath() // Compute the path to use when referencing the current output // directory from the top output directory. this->HomeRelativeOutputPath = this->ConvertToRelativePath( - this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); + this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory()); if (this->HomeRelativeOutputPath == ".") { this->HomeRelativeOutputPath = ""; } @@ -1865,7 +1865,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( i != includes.end(); ++i) { cmakefileStream << " \"" << this->ConvertToRelativePath( - *i, cmOutputConverter::HOME_OUTPUT) + this->GetBinaryDirectory(), *i) << "\"\n"; } cmakefileStream << " )\n"; @@ -1930,7 +1930,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall( if (!tgt.empty()) { // The make target is always relative to the top of the build tree. std::string tgt2 = - this->ConvertToRelativePath(tgt, cmOutputConverter::HOME_OUTPUT); + this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt); // The target may have been written with windows paths. cmSystemTools::ConvertToOutputSlashes(tgt2); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index df06dc19b..fc5af4a21 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -317,7 +317,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()( this->Generator->LocalGenerator->ConvertToRelativePath( this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output)); output = this->Generator->LocalGenerator->ConvertToRelativePath( - output, cmOutputConverter::HOME_OUTPUT); + this->Generator->LocalGenerator->GetBinaryDirectory(), output); // Create a rule to copy the content into the bundle. std::vector depends; @@ -1275,7 +1275,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule( std::string buildTargetRuleName = dir; buildTargetRuleName += relink ? "/preinstall" : "/build"; buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath( - buildTargetRuleName, cmOutputConverter::HOME_OUTPUT); + this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName); // Build the list of target outputs to drive. std::vector depends;