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

View File

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

View File

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

View File

@ -305,13 +305,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
comment += makefileIn; comment += makefileIn;
std::string args; std::string args;
args = "-H"; args = "-H";
args += this->Convert(this->Makefile->GetHomeDirectory(), args += this->Makefile->GetHomeDirectory();
START_OUTPUT, UNCHANGED, true);
commandLine.push_back(args); commandLine.push_back(args);
args = "-B"; args = "-B";
args += args += this->Makefile->GetHomeOutputDirectory();
this->Convert(this->Makefile->GetHomeOutputDirectory(),
START_OUTPUT, UNCHANGED, true);
commandLine.push_back(args); commandLine.push_back(args);
commandLine.push_back("--check-stamp-file"); commandLine.push_back("--check-stamp-file");
std::string stampFilename = this->Convert(stampName.c_str(), FULL, 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) if(emitted.insert(*i).second)
{ {
flags += fwSearchFlag; flags += fwSearchFlag;
flags += this->Convert(*i, flags += this->LocalGenerator
cmLocalGenerator::START_OUTPUT, ->ConvertToOutputFormat(*i, cmLocalGenerator::SHELL);
cmLocalGenerator::SHELL, true);
flags += " "; flags += " ";
} }
} }

View File

@ -273,10 +273,9 @@ protected:
std::string Convert(const std::string& source, std::string Convert(const std::string& source,
cmLocalGenerator::RelativeRoot relative, cmLocalGenerator::RelativeRoot relative,
cmLocalGenerator::OutputFormat output = cmLocalGenerator::OutputFormat output =
cmLocalGenerator::UNCHANGED, cmLocalGenerator::UNCHANGED)
bool optional = false)
{ {
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 return forceRelative
? cmSystemTools::RelativePath( ? cmSystemTools::RelativePath(
this->Makefile->GetCurrentBinaryDirectory(), path.c_str()) this->Makefile->GetCurrentBinaryDirectory(), path.c_str())
: this->LocalGenerator->Convert(path.c_str(), : path.c_str();
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED,
/* optional = */ true);
} }
void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s) void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)