BUG: Fixed display of custom command comments with quotes, dollars, and other special characters in them.

This commit is contained in:
Brad King 2006-10-04 18:52:29 -04:00
parent 038c9e27d7
commit 406f3554c7
7 changed files with 13 additions and 24 deletions

View File

@ -43,7 +43,6 @@ void cmGlobalBorlandMakefileGenerator
cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetEchoNeedsQuote(false);
lg->SetIncludeDirective("!include");
lg->SetWindowsShell(true);
lg->SetDefineWindowsNULL(true);

View File

@ -39,7 +39,6 @@ void cmGlobalNMakeMakefileGenerator
cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetEchoNeedsQuote(false);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("/nologo");

View File

@ -48,7 +48,6 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator()
{
cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3;
lg->SetSilentNoColon(true);
lg->SetEchoNeedsQuote(false);
lg->SetDefineWindowsNULL(true);
lg->SetWindowsShell(true);
lg->SetMakeSilentFlag("-s -h");

View File

@ -2278,7 +2278,8 @@ std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
}
//----------------------------------------------------------------------------
std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars)
std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars,
bool forEcho)
{
// Compute the flags for the target shell environment.
int flags = 0;
@ -2294,6 +2295,10 @@ std::string cmLocalGenerator::EscapeForShell(const char* str, bool makeVars)
{
flags |= cmsysSystem_Shell_Flag_AllowMakeVariables;
}
if(forEcho)
{
flags |= cmsysSystem_Shell_Flag_EchoWindows;
}
// Compute the buffer size needed.
int size = (this->WindowsShell ?

View File

@ -204,8 +204,11 @@ public:
/** Escape the given string to be used as a command line argument in
the native build system shell. Optionally allow the build
system to replace make variable references. */
std::string EscapeForShell(const char* str, bool makeVars = false);
system to replace make variable references. Optionally adjust
escapes for the special case of passing to the native echo
command. */
std::string EscapeForShell(const char* str, bool makeVars = false,
bool forEcho = false);
/** Backwards-compatibility version of EscapeForShell. */
std::string EscapeForShellOldStyle(const char* str);

View File

@ -44,7 +44,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->MakefileVariableSize = 0;
this->IgnoreLibPrefix = false;
this->PassMakeflags = false;
this->EchoNeedsQuote = true;
this->DefineWindowsNULL = false;
this->UnixCD = true;
this->ForceVerboseMakefiles=false;
@ -1046,24 +1045,14 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands,
{
// Use the native echo command.
cmd = "@echo ";
if(this->EchoNeedsQuote)
{
cmd += "\"";
}
cmd += line;
if(this->EchoNeedsQuote)
{
cmd += "\"";
}
cmd += this->EscapeForShell(line.c_str(), false, true);
}
else
{
// Use cmake to echo the text in color.
cmd = "@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) ";
cmd += color_name;
cmd += "\"";
cmd += line;
cmd += "\"";
cmd += this->EscapeForShell(line.c_str());
}
commands.push_back(cmd);
}

View File

@ -97,9 +97,6 @@ public:
void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; }
std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; }
/** Set whether the echo command needs its argument quoted. */
void SetEchoNeedsQuote(bool b) { this->EchoNeedsQuote = b; }
/**
* Set to true if the shell being used is the windows shell.
* This controls if statements in the makefile and the SHELL variable.
@ -339,8 +336,6 @@ private:
bool UnixCD;
bool PassMakeflags;
bool SilentNoColon;
// Flag for whether echo command needs quotes.
bool EchoNeedsQuote;
//==========================================================================
std::string HomeRelativeOutputPath;