diff options
author | Brad King <brad.king@kitware.com> | 2015-07-07 18:31:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-07-08 13:00:00 (GMT) |
commit | bb7eefe4dd4b1385b830ac0f784af883a3d91985 (patch) | |
tree | 55c846e7bb05db830fe52cb333957bd5e4583fde | |
parent | cedd6e65d22870524eaee1394f023cf001d56aff (diff) | |
download | CMake-bb7eefe4dd4b1385b830ac0f784af883a3d91985.zip CMake-bb7eefe4dd4b1385b830ac0f784af883a3d91985.tar.gz CMake-bb7eefe4dd4b1385b830ac0f784af883a3d91985.tar.bz2 |
cmOutputConverter: Adopt EscapeWindowsShellArgument method
Move it out of cmSystemTools and into cmOutputConverter.
-rw-r--r-- | Source/cmOutputConverter.cxx | 20 | ||||
-rw-r--r-- | Source/cmOutputConverter.h | 5 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 19 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 5 | ||||
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 3 |
5 files changed, 27 insertions, 25 deletions
diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index b0a30a1..161a5b4 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -412,6 +412,26 @@ std::string cmOutputConverter::EscapeForCMake(const std::string& str) } //---------------------------------------------------------------------------- +std::string +cmOutputConverter::EscapeWindowsShellArgument(const char* arg, int shell_flags) +{ + char local_buffer[1024]; + char* buffer = local_buffer; + int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags); + if(size > 1024) + { + buffer = new char[size]; + } + cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags); + std::string result(buffer); + if(buffer != local_buffer) + { + delete [] buffer; + } + return result; +} + +//---------------------------------------------------------------------------- cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat(const char* value) { diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 482a64b..8739b97 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -71,6 +71,11 @@ public: static std::string EscapeForCMake(const std::string& str); + /** Compute an escaped version of the given argument for use in a + windows shell. */ + static std::string EscapeWindowsShellArgument(const char* arg, + int shell_flags); + enum FortranFormat { FortranFormatNone, diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7230a64..2543e68 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -556,25 +556,6 @@ void cmSystemTools::ParseUnixCommandLine(const char* command, argv.Store(args); } -std::string cmSystemTools::EscapeWindowsShellArgument(const char* arg, - int shell_flags) -{ - char local_buffer[1024]; - char* buffer = local_buffer; - int size = cmsysSystem_Shell_GetArgumentSizeForWindows(arg, shell_flags); - if(size > 1024) - { - buffer = new char[size]; - } - cmsysSystem_Shell_GetArgumentForWindows(arg, buffer, shell_flags); - std::string result(buffer); - if(buffer != local_buffer) - { - delete [] buffer; - } - return result; -} - std::vector<std::string> cmSystemTools::ParseArguments(const char* command) { std::vector<std::string> args; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 8ebb4e3..fb58307 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -256,11 +256,6 @@ public: static void ParseUnixCommandLine(const char* command, std::vector<std::string>& args); - /** Compute an escaped version of the given argument for use in a - windows shell. See kwsys/System.h.in for details. */ - static std::string EscapeWindowsShellArgument(const char* arg, - int shell_flags); - static void EnableMessages() { s_DisableMessages = false; } static void DisableMessages() { s_DisableMessages = true; } static void DisableRunCommandOutput() {s_DisableRunCommandOutput = true; } diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6512fc2..c028ab7 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -1,4 +1,5 @@ #include "cmVisualStudioGeneratorOptions.h" +#include "cmOutputConverter.h" #include "cmSystemTools.h" #include <cmsys/System.h> #include "cmVisualStudio10TargetGenerator.h" @@ -246,7 +247,7 @@ void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag) // This option is not known. Store it in the output flags. this->FlagString += " "; this->FlagString += - cmSystemTools::EscapeWindowsShellArgument( + cmOutputConverter::EscapeWindowsShellArgument( flag, cmsysSystem_Shell_Flag_AllowMakeVariables | cmsysSystem_Shell_Flag_VSIDE); |