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
// 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;

View File

@ -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;

View File

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

View File

@ -760,8 +760,8 @@ std::string cmGlobalNinjaGenerator::ConvertToNinjaPath(const std::string& path)
{
cmLocalNinjaGenerator* ng =
static_cast<cmLocalNinjaGenerator*>(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(), '/', '\\');

View File

@ -356,8 +356,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
for (std::vector<std::string>::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()) {

View File

@ -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 = "";
}

View File

@ -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);

View File

@ -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<std::string> 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<std::string> depends;