diff options
author | Brad King <brad.king@kitware.com> | 2006-10-04 22:52:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-10-04 22:52:29 (GMT) |
commit | 406f3554c787f6926e9775f953e8f590db78803e (patch) | |
tree | 8968bcf410707e07d074779ca0ea3e69c0dee598 /Source | |
parent | 038c9e27d78b2df56460c85a1a797c7e0dc3e149 (diff) | |
download | CMake-406f3554c787f6926e9775f953e8f590db78803e.zip CMake-406f3554c787f6926e9775f953e8f590db78803e.tar.gz CMake-406f3554c787f6926e9775f953e8f590db78803e.tar.bz2 |
BUG: Fixed display of custom command comments with quotes, dollars, and other special characters in them.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalBorlandMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalNMakeMakefileGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmGlobalWatcomWMakeGenerator.cxx | 1 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 7 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 15 | ||||
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.h | 5 |
7 files changed, 13 insertions, 24 deletions
diff --git a/Source/cmGlobalBorlandMakefileGenerator.cxx b/Source/cmGlobalBorlandMakefileGenerator.cxx index 1ce506d..bba00ae 100644 --- a/Source/cmGlobalBorlandMakefileGenerator.cxx +++ b/Source/cmGlobalBorlandMakefileGenerator.cxx @@ -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); diff --git a/Source/cmGlobalNMakeMakefileGenerator.cxx b/Source/cmGlobalNMakeMakefileGenerator.cxx index 35a2a86..e86c7c6 100644 --- a/Source/cmGlobalNMakeMakefileGenerator.cxx +++ b/Source/cmGlobalNMakeMakefileGenerator.cxx @@ -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"); diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx index 6f6c8cf..29a60d4 100644 --- a/Source/cmGlobalWatcomWMakeGenerator.cxx +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -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"); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fe89580..3436d6f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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 ? diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index f12ed9c..53b4220 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -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); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 4460c46..c39b898 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -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); } diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 31c3e58..260f2aa 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -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; |