Convert: Replace Convert(FULL) with equivalent

This is more explicit than funnelling everything through the Convert
method.
This commit is contained in:
Stephen Kelly 2016-08-27 13:44:57 +02:00
parent e80314d7a8
commit 58ba87f892
7 changed files with 57 additions and 38 deletions

View File

@ -723,8 +723,9 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
std::ostringstream progCmd; std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
// # in target // # in target
progCmd << lg->Convert(progress.Dir, cmOutputConverter::FULL, progCmd << lg->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(progress.Dir),
cmOutputConverter::SHELL);
// //
std::set<cmGeneratorTarget const*> emitted; std::set<cmGeneratorTarget const*> emitted;
progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted); progCmd << " " << this->CountProgressMarksInTarget(gtarget, emitted);
@ -736,8 +737,9 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
{ {
std::ostringstream progCmd; std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
progCmd << lg->Convert(progress.Dir, cmOutputConverter::FULL, progCmd << lg->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(progress.Dir),
cmOutputConverter::SHELL);
progCmd << " 0"; progCmd << " 0";
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
} }

View File

@ -688,7 +688,9 @@ std::string cmLocalGenerator::ExpandRuleVariable(
} }
} }
if (variable == "CMAKE_COMMAND") { if (variable == "CMAKE_COMMAND") {
return this->Convert(cmSystemTools::GetCMakeCommand(), FULL, SHELL); return this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
SHELL);
} }
std::vector<std::string> enabledLanguages = std::vector<std::string> enabledLanguages =
this->GetState()->GetEnabledLanguages(); this->GetState()->GetEnabledLanguages();
@ -1183,7 +1185,8 @@ void cmLocalGenerator::GetTargetFlags(
if (sf->GetExtension() == "def") { if (sf->GetExtension() == "def") {
linkFlags += linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG"); this->Makefile->GetSafeDefinition("CMAKE_LINK_DEF_FILE_FLAG");
linkFlags += this->Convert(sf->GetFullPath(), FULL, SHELL); linkFlags += this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(sf->GetFullPath()), SHELL);
linkFlags += " "; linkFlags += " ";
} }
} }

View File

@ -133,7 +133,8 @@ std::string cmLocalNinjaGenerator::ConvertToIncludeReference(
bool forceFullPaths) bool forceFullPaths)
{ {
if (forceFullPaths) { if (forceFullPaths) {
return this->Convert(path, cmOutputConverter::FULL, format); return this->ConvertToOutputFormat(cmSystemTools::CollapseFullPath(path),
format);
} }
return this->Convert(path, cmOutputConverter::HOME_OUTPUT, format); return this->Convert(path, cmOutputConverter::HOME_OUTPUT, format);
} }

View File

@ -640,9 +640,9 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
std::string cmakeShellCommand = std::string cmakeShellCommand =
this->MaybeConvertWatcomShellCommand(cmSystemTools::GetCMakeCommand()); this->MaybeConvertWatcomShellCommand(cmSystemTools::GetCMakeCommand());
if (cmakeShellCommand.empty()) { if (cmakeShellCommand.empty()) {
cmakeShellCommand = cmakeShellCommand = this->ConvertToOutputFormat(
this->Convert(cmSystemTools::GetCMakeCommand(), cmOutputConverter::FULL, cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
cmOutputConverter::SHELL); cmOutputConverter::SHELL);
} }
/* clang-format off */ /* clang-format off */
@ -665,16 +665,16 @@ void cmLocalUnixMakefileGenerator3::WriteMakeVariables(
makefileStream makefileStream
<< "# The top-level source directory on which CMake was run.\n" << "# The top-level source directory on which CMake was run.\n"
<< "CMAKE_SOURCE_DIR = " << "CMAKE_SOURCE_DIR = "
<< this->Convert(this->GetSourceDirectory(), << this->ConvertToOutputFormat(
cmOutputConverter::FULL, cmSystemTools::CollapseFullPath(this->GetSourceDirectory()),
cmOutputConverter::SHELL) cmOutputConverter::SHELL)
<< "\n" << "\n"
<< "\n"; << "\n";
makefileStream makefileStream
<< "# The top-level build directory on which CMake was run.\n" << "# The top-level build directory on which CMake was run.\n"
<< "CMAKE_BINARY_DIR = " << "CMAKE_BINARY_DIR = "
<< this->Convert(this->GetBinaryDirectory(), << this->ConvertToOutputFormat(
cmOutputConverter::FULL, cmSystemTools::CollapseFullPath(this->GetBinaryDirectory()),
cmOutputConverter::SHELL) cmOutputConverter::SHELL)
<< "\n" << "\n"
<< "\n"; << "\n";
@ -1154,8 +1154,9 @@ void cmLocalUnixMakefileGenerator3::AppendEcho(
cmd += color_name; cmd += color_name;
if (progress) { if (progress) {
cmd += "--progress-dir="; cmd += "--progress-dir=";
cmd += this->Convert(progress->Dir, cmOutputConverter::FULL, cmd += this->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(progress->Dir),
cmOutputConverter::SHELL);
cmd += " "; cmd += " ";
cmd += "--progress-num="; cmd += "--progress-num=";
cmd += progress->Arg; cmd += progress->Arg;
@ -1603,15 +1604,16 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
{ {
std::ostringstream progCmd; std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start ";
progCmd << this->Convert(progressDir, cmOutputConverter::FULL, progCmd << this->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(progressDir), cmOutputConverter::SHELL);
std::string progressFile = cmake::GetCMakeFilesDirectory(); std::string progressFile = cmake::GetCMakeFilesDirectory();
progressFile += "/progress.marks"; progressFile += "/progress.marks";
std::string progressFileNameFull = this->ConvertToFullPath(progressFile); std::string progressFileNameFull = this->ConvertToFullPath(progressFile);
progCmd << " " progCmd << " "
<< this->Convert(progressFileNameFull, cmOutputConverter::FULL, << this->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(progressFileNameFull),
cmOutputConverter::SHELL);
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
} }
std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash(); std::string mf2Dir = cmake::GetCMakeFilesDirectoryPostSlash();
@ -1623,8 +1625,8 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
{ {
std::ostringstream progCmd; std::ostringstream progCmd;
progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0 progCmd << "$(CMAKE_COMMAND) -E cmake_progress_start "; // # 0
progCmd << this->Convert(progressDir, cmOutputConverter::FULL, progCmd << this->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(progressDir), cmOutputConverter::SHELL);
progCmd << " 0"; progCmd << " 0";
commands.push_back(progCmd.str()); commands.push_back(progCmd.str());
} }

View File

@ -269,8 +269,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
args += this->GetBinaryDirectory(); args += this->GetBinaryDirectory();
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( std::string stampFilename = this->ConvertToOutputFormat(
stampName.c_str(), cmOutputConverter::FULL, cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(stampName), cmOutputConverter::SHELL);
commandLine.push_back(stampFilename.c_str()); commandLine.push_back(stampFilename.c_str());
std::vector<std::string> const& listFiles = this->Makefile->GetListFiles(); std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();

View File

@ -155,7 +155,8 @@ std::string cmLocalVisualStudioGenerator::ConstructScript(
script += newline; script += newline;
newline = newline_text; newline = newline_text;
script += "cd "; script += "cd ";
script += this->Convert(workingDirectory, FULL, SHELL); script += this->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(workingDirectory), SHELL);
script += check_error; script += check_error;
// Change the working drive. // Change the working drive.

View File

@ -1000,9 +1000,10 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// paths. Make sure PWD is set to the original name of the home // paths. Make sure PWD is set to the original name of the home
// output directory to help cmSystemTools to create the same // output directory to help cmSystemTools to create the same
// translation table for the dependency scanning process. // translation table for the dependency scanning process.
depCmd << "cd " << (this->LocalGenerator->Convert( depCmd << "cd " << (this->LocalGenerator->ConvertToOutputFormat(
this->LocalGenerator->GetBinaryDirectory(), cmSystemTools::CollapseFullPath(
cmOutputConverter::FULL, cmOutputConverter::SHELL)) this->LocalGenerator->GetBinaryDirectory()),
cmOutputConverter::SHELL))
<< " && "; << " && ";
#endif #endif
// Generate a call this signature: // Generate a call this signature:
@ -1016,20 +1017,29 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
// the state of our local generator sufficiently for its needs. // the state of our local generator sufficiently for its needs.
depCmd << "$(CMAKE_COMMAND) -E cmake_depends \"" depCmd << "$(CMAKE_COMMAND) -E cmake_depends \""
<< this->GlobalGenerator->GetName() << "\" " << this->GlobalGenerator->GetName() << "\" "
<< this->Convert(this->LocalGenerator->GetSourceDirectory(), << this->LocalGenerator->ConvertToOutputFormat(
cmOutputConverter::FULL, cmOutputConverter::SHELL) cmSystemTools::CollapseFullPath(
this->LocalGenerator->GetSourceDirectory()),
cmOutputConverter::SHELL)
<< " " << " "
<< this->Convert(this->LocalGenerator->GetCurrentSourceDirectory(), << this->LocalGenerator->ConvertToOutputFormat(
cmOutputConverter::FULL, cmOutputConverter::SHELL) cmSystemTools::CollapseFullPath(
this->LocalGenerator->GetCurrentSourceDirectory()),
cmOutputConverter::SHELL)
<< " " << " "
<< this->Convert(this->LocalGenerator->GetBinaryDirectory(), << this->LocalGenerator->ConvertToOutputFormat(
cmOutputConverter::FULL, cmOutputConverter::SHELL) cmSystemTools::CollapseFullPath(
this->LocalGenerator->GetBinaryDirectory()),
cmOutputConverter::SHELL)
<< " " << " "
<< this->Convert(this->LocalGenerator->GetCurrentBinaryDirectory(), << this->LocalGenerator->ConvertToOutputFormat(
cmOutputConverter::FULL, cmOutputConverter::SHELL) cmSystemTools::CollapseFullPath(
this->LocalGenerator->GetCurrentBinaryDirectory()),
cmOutputConverter::SHELL)
<< " " << " "
<< this->Convert(this->InfoFileNameFull, cmOutputConverter::FULL, << this->LocalGenerator->ConvertToOutputFormat(
cmOutputConverter::SHELL); cmSystemTools::CollapseFullPath(this->InfoFileNameFull),
cmOutputConverter::SHELL);
if (this->LocalGenerator->GetColorMakefile()) { if (this->LocalGenerator->GetColorMakefile()) {
depCmd << " --color=$(COLOR)"; depCmd << " --color=$(COLOR)";
} }