cmSystemTools: Add RunSingleCommand overload for std::vector<std::string>

This commit is contained in:
Brad King 2013-11-15 13:30:10 -05:00
parent 2d072069e2
commit ee6e4ac841
2 changed files with 22 additions and 1 deletions

View File

@ -615,9 +615,25 @@ bool cmSystemTools::RunSingleCommand(std::vector<cmStdString>const& command,
int* retVal , const char* dir , int* retVal , const char* dir ,
OutputOption outputflag , OutputOption outputflag ,
double timeout ) double timeout )
{
std::vector<std::string> cmd;
for(std::vector<cmStdString>::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::vector<std::string>const& command,
std::string* output ,
int* retVal , const char* dir ,
OutputOption outputflag ,
double timeout )
{ {
std::vector<const char*> argv; std::vector<const char*> argv;
for(std::vector<cmStdString>::const_iterator a = command.begin(); for(std::vector<std::string>::const_iterator a = command.begin();
a != command.end(); ++a) a != command.end(); ++a)
{ {
argv.push_back(a->c_str()); argv.push_back(a->c_str());

View File

@ -228,6 +228,11 @@ public:
* the command to run, and each argument to the command should * the command to run, and each argument to the command should
* be in comand[1]...command[command.size()] * be in comand[1]...command[command.size()]
*/ */
static bool RunSingleCommand(std::vector<std::string> 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<cmStdString> const& command, static bool RunSingleCommand(std::vector<cmStdString> const& command,
std::string* output = 0, std::string* output = 0,
int* retVal = 0, const char* dir = 0, int* retVal = 0, const char* dir = 0,