Ver código fonte

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

Brad King 12 anos atrás
pai
commit
ee6e4ac841
2 arquivos alterados com 22 adições e 1 exclusões
  1. 17 1
      Source/cmSystemTools.cxx
  2. 5 0
      Source/cmSystemTools.h

+ 17 - 1
Source/cmSystemTools.cxx

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

+ 5 - 0
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<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,
                                std::string* output = 0,
                                int* retVal = 0, const char* dir = 0,