cmLocalGenerator: Remove 'optional' parameter from Convert.

Port callers away from it.
This commit is contained in:
Stephen Kelly 2015-06-01 20:23:11 +02:00 committed by Brad King
parent 3d8c6cd964
commit 6e570f857a
8 changed files with 47 additions and 66 deletions

View File

@ -310,14 +310,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
cmCustomCommandLine commandLine;
commandLine.push_back(cmSystemTools::GetCMakeCommand());
std::string argH = "-H";
argH += lg->Convert(mf->GetHomeDirectory(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED, true);
argH += mf->GetHomeDirectory();
commandLine.push_back(argH);
std::string argB = "-B";
argB += lg->Convert(mf->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED, true);
argB += mf->GetHomeOutputDirectory();
commandLine.push_back(argB);
commandLine.push_back("--check-stamp-list");
commandLine.push_back(stampList.c_str());

View File

@ -517,7 +517,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
objectDir = this->Convert(objectDir,START_OUTPUT,SHELL);
std::string objectFile = this->Convert(ofname,START_OUTPUT,SHELL);
std::string sourceFile =
this->Convert(source.GetFullPath(),START_OUTPUT,SHELL,true);
this->ConvertToOutputFormat(source.GetFullPath(), SHELL);
std::string varString = "CMAKE_";
varString += lang;
varString += "_COMPILE_OBJECT";
@ -1177,7 +1177,7 @@ cmLocalGenerator::ConvertToOutputForExistingCommon(const std::string& remote,
std::string tmp;
if(cmSystemTools::GetShortPath(remote, tmp))
{
return this->Convert(tmp, NONE, format, true);
return this->ConvertToOutputFormat(tmp, format);
}
}
@ -1191,8 +1191,10 @@ cmLocalGenerator::ConvertToOutputForExisting(const std::string& remote,
RelativeRoot local,
OutputFormat format)
{
static_cast<void>(local);
// Perform standard conversion.
std::string result = this->Convert(remote, local, format, true);
std::string result = this->ConvertToOutputFormat(remote, format);
// Consider short-path.
return this->ConvertToOutputForExistingCommon(remote, result, format);
@ -1311,8 +1313,7 @@ std::string cmLocalGenerator::GetIncludeFlags(
{
includeFlags << fwSearchFlag;
}
includeFlags << this->Convert(frameworkDir, START_OUTPUT,
shellFormat, true)
includeFlags << this->ConvertToOutputFormat(frameworkDir, shellFormat)
<< " ";
}
continue;
@ -2686,42 +2687,39 @@ const char* cmLocalGenerator::GetRelativeRootPath(RelativeRoot relroot)
//----------------------------------------------------------------------------
std::string cmLocalGenerator::Convert(const std::string& source,
RelativeRoot relative,
OutputFormat output,
bool optional)
OutputFormat output)
{
// Convert the path to a relative path.
std::string result = source;
if (!optional)
switch (relative)
{
switch (relative)
{
case HOME:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->GetState()->GetSourceDirectoryComponents(), result);
break;
case START:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
break;
case HOME_OUTPUT:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->GetState()->GetBinaryDirectoryComponents(), result);
break;
case START_OUTPUT:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
break;
case FULL:
result = cmSystemTools::CollapseFullPath(result);
break;
case NONE:
break;
}
case HOME:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->GetState()->GetSourceDirectoryComponents(), result);
break;
case START:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->StateSnapshot.GetCurrentSourceDirectoryComponents(), result);
break;
case HOME_OUTPUT:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->GetState()->GetBinaryDirectoryComponents(), result);
break;
case START_OUTPUT:
//result = cmSystemTools::CollapseFullPath(result.c_str());
result = this->ConvertToRelativePath(
this->StateSnapshot.GetCurrentBinaryDirectoryComponents(), result);
break;
case FULL:
result = cmSystemTools::CollapseFullPath(result);
break;
case NONE:
break;
}
return this->ConvertToOutputFormat(result, output);
}
@ -2765,8 +2763,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source,
//----------------------------------------------------------------------------
std::string cmLocalGenerator::Convert(RelativeRoot remote,
const std::string& local,
OutputFormat output,
bool optional)
OutputFormat output, bool optional)
{
const char* remotePath = this->GetRelativeRootPath(remote);

View File

@ -115,8 +115,7 @@ public:
std::string ConvertToOutputFormat(const std::string& source,
OutputFormat output);
std::string Convert(const std::string& remote, RelativeRoot local,
OutputFormat output = UNCHANGED,
bool optional = false);
OutputFormat output = UNCHANGED);
std::string Convert(RelativeRoot remote, const std::string& local,
OutputFormat output = UNCHANGED,
bool optional = false);

View File

@ -235,13 +235,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
comment += makefileIn;
std::string args;
args = "-H";
args += this->Convert(this->Makefile->GetHomeDirectory(),
START_OUTPUT, UNCHANGED, true);
args += this->Makefile->GetHomeDirectory();
commandLine.push_back(args);
args = "-B";
args +=
this->Convert(this->Makefile->GetHomeOutputDirectory(),
START_OUTPUT, UNCHANGED, true);
args += this->Makefile->GetHomeOutputDirectory();
commandLine.push_back(args);
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();

View File

@ -305,13 +305,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
comment += makefileIn;
std::string args;
args = "-H";
args += this->Convert(this->Makefile->GetHomeDirectory(),
START_OUTPUT, UNCHANGED, true);
args += this->Makefile->GetHomeDirectory();
commandLine.push_back(args);
args = "-B";
args +=
this->Convert(this->Makefile->GetHomeOutputDirectory(),
START_OUTPUT, UNCHANGED, true);
args += this->Makefile->GetHomeOutputDirectory();
commandLine.push_back(args);
commandLine.push_back("--check-stamp-file");
std::string stampFilename = this->Convert(stampName.c_str(), FULL,

View File

@ -1589,9 +1589,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags(std::string const& l)
if(emitted.insert(*i).second)
{
flags += fwSearchFlag;
flags += this->Convert(*i,
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL, true);
flags += this->LocalGenerator
->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL);
flags += " ";
}
}

View File

@ -273,10 +273,9 @@ protected:
std::string Convert(const std::string& source,
cmLocalGenerator::RelativeRoot relative,
cmLocalGenerator::OutputFormat output =
cmLocalGenerator::UNCHANGED,
bool optional = false)
cmLocalGenerator::UNCHANGED)
{
return this->LocalGenerator->Convert(source, relative, output, optional);
return this->LocalGenerator->Convert(source, relative, output);
}
};

View File

@ -923,10 +923,7 @@ cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path,
return forceRelative
? cmSystemTools::RelativePath(
this->Makefile->GetCurrentBinaryDirectory(), path.c_str())
: this->LocalGenerator->Convert(path.c_str(),
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED,
/* optional = */ true);
: path.c_str();
}
void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)