From ee6e4ac841d8094b59cd0a48c61d7ca3b68c68c2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 15 Nov 2013 13:30:10 -0500 Subject: [PATCH] cmSystemTools: Add RunSingleCommand overload for std::vector --- Source/cmSystemTools.cxx | 18 +++++++++++++++++- Source/cmSystemTools.h | 5 +++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f5376eb4b..8a0d8dc38 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -615,9 +615,25 @@ bool cmSystemTools::RunSingleCommand(std::vectorconst& command, int* retVal , const char* dir , OutputOption outputflag , double timeout ) +{ + std::vector cmd; + for(std::vector::const_iterator i = command.begin(); + i != command.end(); ++i) + { + cmd.push_back(*i); + } + return cmSystemTools::RunSingleCommand(cmd, output, retVal, dir, + outputflag, timeout); +} + +bool cmSystemTools::RunSingleCommand(std::vectorconst& command, + std::string* output , + int* retVal , const char* dir , + OutputOption outputflag , + double timeout ) { std::vector argv; - for(std::vector::const_iterator a = command.begin(); + for(std::vector::const_iterator a = command.begin(); a != command.end(); ++a) { argv.push_back(a->c_str()); diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 69f6381d6..95c702925 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -228,6 +228,11 @@ public: * the command to run, and each argument to the command should * be in comand[1]...command[command.size()] */ + static bool RunSingleCommand(std::vector const& command, + std::string* output = 0, + int* retVal = 0, const char* dir = 0, + OutputOption outputflag = OUTPUT_MERGE, + double timeout = 0.0); static bool RunSingleCommand(std::vector const& command, std::string* output = 0, int* retVal = 0, const char* dir = 0,