Convert: Avoid HOME_OUTPUT enum when converting to relative paths

This commit is contained in:
Stephen Kelly 2016-09-06 23:02:23 +02:00
parent 839c65bca0
commit 34c6e995f9
9 changed files with 18 additions and 17 deletions

View File

@ -240,7 +240,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// convert the dependencies to paths relative to the home output // convert the dependencies to paths relative to the home output
// directory. We must do the same here. // directory. We must do the same here.
std::string obj_i = this->LocalGenerator->ConvertToRelativePath( std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
obj, cmOutputConverter::HOME_OUTPUT); this->LocalGenerator->GetBinaryDirectory(), obj);
std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
obj_i, cmOutputConverter::MAKERULE); obj_i, cmOutputConverter::MAKERULE);
internalDepends << obj_i << std::endl; internalDepends << obj_i << std::endl;

View File

@ -332,7 +332,7 @@ bool cmDependsFortran::WriteDependenciesReal(const char* obj,
// Write the include dependencies to the output stream. // Write the include dependencies to the output stream.
std::string obj_i = this->LocalGenerator->ConvertToRelativePath( std::string obj_i = this->LocalGenerator->ConvertToRelativePath(
obj, cmOutputConverter::HOME_OUTPUT); this->LocalGenerator->GetBinaryDirectory(), obj);
std::string obj_m = this->LocalGenerator->ConvertToOutputFormat( std::string obj_m = this->LocalGenerator->ConvertToOutputFormat(
obj_i, cmOutputConverter::MAKERULE); obj_i, cmOutputConverter::MAKERULE);
internalDepends << obj_i << std::endl; internalDepends << obj_i << std::endl;

View File

@ -914,7 +914,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::vector<cmGeneratorTarget*> targets = const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets(); (*it)->GetGeneratorTargets();
std::string subdir = (*it)->ConvertToRelativePath( std::string subdir = (*it)->ConvertToRelativePath(
(*it)->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); (*it)->GetBinaryDirectory(), (*it)->GetCurrentBinaryDirectory());
if (subdir == ".") { if (subdir == ".") {
subdir = ""; subdir = "";
} }

View File

@ -2579,7 +2579,7 @@ void cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
// Shorten the output name (in expected use case). // Shorten the output name (in expected use case).
cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot()); cmOutputConverter converter(this->GetMakefiles()[0]->GetStateSnapshot());
std::string fname = converter.ConvertToRelativePath( std::string fname = converter.ConvertToRelativePath(
outputs[0], cmOutputConverter::HOME_OUTPUT); this->GetMakefiles()[0]->GetState()->GetBinaryDirectory(), outputs[0]);
// Associate the hash with this output. // Associate the hash with this output.
this->RuleHashes[fname] = hash; this->RuleHashes[fname] = hash;

View File

@ -760,8 +760,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
{ {
cmLocalNinjaGenerator* ng = cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]); static_cast<cmLocalNinjaGenerator*>(this->LocalGenerators[0]);
std::string convPath = std::string convPath = ng->ConvertToRelativePath(
ng->ConvertToRelativePath(path, cmOutputConverter::HOME_OUTPUT); this->LocalGenerators[0]->GetState()->GetBinaryDirectory(), path);
convPath = this->NinjaOutputPath(convPath); convPath = this->NinjaOutputPath(convPath);
#ifdef _WIN32 #ifdef _WIN32
std::replace(convPath.begin(), convPath.end(), '/', '\\'); std::replace(convPath.begin(), convPath.end(), '/', '\\');

View File

@ -356,8 +356,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
for (std::vector<std::string>::const_iterator k = outfiles.begin(); for (std::vector<std::string>::const_iterator k = outfiles.begin();
k != outfiles.end(); ++k) { k != outfiles.end(); ++k) {
cmakefileStream << " \"" cmakefileStream << " \""
<< lg->ConvertToRelativePath( << lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
*k, cmOutputConverter::HOME_OUTPUT) *k)
<< "\"\n"; << "\"\n";
} }
@ -370,8 +370,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
tmpStr += cmake::GetCMakeFilesDirectory(); tmpStr += cmake::GetCMakeFilesDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake"; tmpStr += "/CMakeDirectoryInformation.cmake";
cmakefileStream << " \"" cmakefileStream << " \""
<< lg->ConvertToRelativePath( << lg->ConvertToRelativePath(lg->GetBinaryDirectory(),
tmpStr, cmOutputConverter::HOME_OUTPUT) tmpStr)
<< "\"\n"; << "\"\n";
} }
cmakefileStream << " )\n\n"; cmakefileStream << " )\n\n";
@ -532,7 +532,8 @@ void cmGlobalUnixMakefileGenerator3::GenerateBuildCommand(
tname += "/fast"; tname += "/fast";
} }
cmOutputConverter conv(mf->GetStateSnapshot()); cmOutputConverter conv(mf->GetStateSnapshot());
tname = conv.ConvertToRelativePath(tname, cmOutputConverter::HOME_OUTPUT); tname =
conv.ConvertToRelativePath(mf->GetState()->GetBinaryDirectory(), tname);
cmSystemTools::ConvertToOutputSlashes(tname); cmSystemTools::ConvertToOutputSlashes(tname);
makeCommand.push_back(tname); makeCommand.push_back(tname);
if (this->Makefiles.empty()) { if (this->Makefiles.empty()) {

View File

@ -51,7 +51,7 @@ void cmLocalNinjaGenerator::Generate()
// Compute the path to use when referencing the current output // Compute the path to use when referencing the current output
// directory from the top output directory. // directory from the top output directory.
this->HomeRelativeOutputPath = this->ConvertToRelativePath( this->HomeRelativeOutputPath = this->ConvertToRelativePath(
this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
if (this->HomeRelativeOutputPath == ".") { if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = ""; this->HomeRelativeOutputPath = "";
} }

View File

@ -151,7 +151,7 @@ void cmLocalUnixMakefileGenerator3::ComputeHomeRelativeOutputPath()
// Compute the path to use when referencing the current output // Compute the path to use when referencing the current output
// directory from the top output directory. // directory from the top output directory.
this->HomeRelativeOutputPath = this->ConvertToRelativePath( this->HomeRelativeOutputPath = this->ConvertToRelativePath(
this->GetCurrentBinaryDirectory(), cmOutputConverter::HOME_OUTPUT); this->GetBinaryDirectory(), this->GetCurrentBinaryDirectory());
if (this->HomeRelativeOutputPath == ".") { if (this->HomeRelativeOutputPath == ".") {
this->HomeRelativeOutputPath = ""; this->HomeRelativeOutputPath = "";
} }
@ -1865,7 +1865,7 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
i != includes.end(); ++i) { i != includes.end(); ++i) {
cmakefileStream << " \"" cmakefileStream << " \""
<< this->ConvertToRelativePath( << this->ConvertToRelativePath(
*i, cmOutputConverter::HOME_OUTPUT) this->GetBinaryDirectory(), *i)
<< "\"\n"; << "\"\n";
} }
cmakefileStream << " )\n"; cmakefileStream << " )\n";
@ -1930,7 +1930,7 @@ std::string cmLocalUnixMakefileGenerator3::GetRecursiveMakeCall(
if (!tgt.empty()) { if (!tgt.empty()) {
// The make target is always relative to the top of the build tree. // The make target is always relative to the top of the build tree.
std::string tgt2 = std::string tgt2 =
this->ConvertToRelativePath(tgt, cmOutputConverter::HOME_OUTPUT); this->ConvertToRelativePath(this->GetBinaryDirectory(), tgt);
// The target may have been written with windows paths. // The target may have been written with windows paths.
cmSystemTools::ConvertToOutputSlashes(tgt2); cmSystemTools::ConvertToOutputSlashes(tgt2);

View File

@ -317,7 +317,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
this->Generator->LocalGenerator->ConvertToRelativePath( this->Generator->LocalGenerator->ConvertToRelativePath(
this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output)); this->Generator->LocalGenerator->GetCurrentBinaryDirectory(), output));
output = this->Generator->LocalGenerator->ConvertToRelativePath( output = this->Generator->LocalGenerator->ConvertToRelativePath(
output, cmOutputConverter::HOME_OUTPUT); this->Generator->LocalGenerator->GetBinaryDirectory(), output);
// Create a rule to copy the content into the bundle. // Create a rule to copy the content into the bundle.
std::vector<std::string> depends; std::vector<std::string> depends;
@ -1275,7 +1275,7 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
std::string buildTargetRuleName = dir; std::string buildTargetRuleName = dir;
buildTargetRuleName += relink ? "/preinstall" : "/build"; buildTargetRuleName += relink ? "/preinstall" : "/build";
buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath( buildTargetRuleName = this->LocalGenerator->ConvertToRelativePath(
buildTargetRuleName, cmOutputConverter::HOME_OUTPUT); this->LocalGenerator->GetBinaryDirectory(), buildTargetRuleName);
// Build the list of target outputs to drive. // Build the list of target outputs to drive.
std::vector<std::string> depends; std::vector<std::string> depends;