diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c8797d67e..798d890cb 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -293,20 +293,9 @@ bool cmSystemTools::IsOff(const char* val) v == "N" || cmSystemTools::IsNOTFOUND(v.c_str()) || v == "IGNORE"); } -bool cmSystemTools::RunSingleCommand( - const char* command, - std::string* output, - int *retVal, - const char* dir, - bool verbose, - int timeout) +std::vector cmSystemTools::ParseArguments(const char* command) { - if(s_DisableRunCommandOutput) - { - verbose = false; - } - - std::vector args; + std::vector args; std::string arg; bool win_path = false; @@ -365,19 +354,37 @@ bool cmSystemTools::RunSingleCommand( } } + return args; +} + +bool cmSystemTools::RunSingleCommand( + const char* command, + std::string* output, + int *retVal, + const char* dir, + bool verbose, + int timeout) +{ + if(s_DisableRunCommandOutput) + { + verbose = false; + } + + std::vector args = cmSystemTools::ParseArguments(command); + + if(args.size() < 1) + { + return false; + } + std::vector argv; - for(std::vector::const_iterator a = args.begin(); + for(std::vector::const_iterator a = args.begin(); a != args.end(); ++a) { argv.push_back(a->c_str()); } argv.push_back(0); - - if(argv.size() < 2) - { - return false; - } - + if ( output ) { *output = ""; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 7f26b2558..2ecd504f9 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -179,6 +179,11 @@ public: */ static bool RunSingleCommand(const char* command, std::string* output = 0, int* retVal = 0, const char* dir = 0, bool verbose = true, int timeout = 0); + + /** + * Parse arguments out of a single string command + */ + static std::vector ParseArguments(const char* command); static void EnableMessages() { s_DisableMessages = false; } static void DisableMessages() { s_DisableMessages = true; }