浏览代码

ENH: Use the new RunCommand

Andy Cedilnik 22 年之前
父节点
当前提交
0b150f69c2

+ 5 - 1
Source/cmGlobalGenerator.cxx

@@ -24,6 +24,8 @@
 #include <windows.h>
 #include <windows.h>
 #endif
 #endif
 
 
+int cmGlobalGenerator::s_TryCompileTimeout = 0;
+
 cmGlobalGenerator::cmGlobalGenerator()
 cmGlobalGenerator::cmGlobalGenerator()
 {
 {
 // do nothing duh
 // do nothing duh
@@ -485,7 +487,9 @@ int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
     makeCommand += " all";
     makeCommand += " all";
     }
     }
   int retVal;
   int retVal;
-  if (!cmSystemTools::RunCommand(makeCommand.c_str(), *output, retVal, 0, false))
+  int timeout = cmGlobalGenerator::s_TryCompileTimeout;
+  if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, 
+      &retVal, 0, false, timeout))
     {
     {
     cmSystemTools::Error("Generator: execution of make failed.");
     cmSystemTools::Error("Generator: execution of make failed.");
     // return to the original directory
     // return to the original directory

+ 1 - 0
Source/cmGlobalGenerator.h

@@ -102,6 +102,7 @@ public:
 
 
   void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
   void SetConfiguredFilesPath(const char* s){m_ConfiguredFilesPath = s;}
   void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;}
   void GetLocalGenerators(std::vector<cmLocalGenerator *>&g) { g = m_LocalGenerators;}
+  static int s_TryCompileTimeout;
   
   
 protected:
 protected:
   cmStdString m_FindMakeProgramFile;
   cmStdString m_FindMakeProgramFile;

+ 4 - 2
Source/cmGlobalVisualStudio6Generator.cxx

@@ -96,7 +96,7 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
   cmSystemTools::ChangeDirectory(bindir);
   cmSystemTools::ChangeDirectory(bindir);
   // if there are spaces in the makeCommand, assume a full path
   // if there are spaces in the makeCommand, assume a full path
   // and convert it to a path with no spaces in it as the
   // and convert it to a path with no spaces in it as the
-  // RunCommand does not like spaces
+  // RunSingleCommand does not like spaces
 #if defined(_WIN32) && !defined(__CYGWIN__)      
 #if defined(_WIN32) && !defined(__CYGWIN__)      
   if(makeCommand.find(' ') != std::string::npos)
   if(makeCommand.find(' ') != std::string::npos)
     {
     {
@@ -116,7 +116,9 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
     }
     }
   makeCommand += " - Debug\"";
   makeCommand += " - Debug\"";
   int retVal;
   int retVal;
-  if (!cmSystemTools::RunCommand(makeCommand.c_str(), *output, retVal, 0, false))
+  int timeout = cmGlobalGenerator::s_TryCompileTimeout;
+  if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, 
+      &retVal, 0, false, timeout))
     {
     {
     std::string e = "Error executing make program \"";
     std::string e = "Error executing make program \"";
     e += originalCommand;
     e += originalCommand;

+ 4 - 3
Source/cmGlobalVisualStudio7Generator.cxx

@@ -66,7 +66,7 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
 
 
   // if there are spaces in the makeCommand, assume a full path
   // if there are spaces in the makeCommand, assume a full path
   // and convert it to a path with no spaces in it as the
   // and convert it to a path with no spaces in it as the
-  // RunCommand does not like spaces
+  // RunSingleCommand does not like spaces
 #if defined(_WIN32) && !defined(__CYGWIN__)      
 #if defined(_WIN32) && !defined(__CYGWIN__)      
   if(makeCommand.find(' ') != std::string::npos)
   if(makeCommand.find(' ') != std::string::npos)
     {
     {
@@ -86,8 +86,9 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
     }
     }
   
   
   int retVal;
   int retVal;
-  if (!cmSystemTools::RunCommand(makeCommand.c_str(), *output, retVal, 
-                                 0, false))
+  int timeout = cmGlobalGenerator::s_TryCompileTimeout;
+  if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, &retVal, 
+      0, false, timeout))
     {
     {
     cmSystemTools::Error("Generator: execution of devenv failed.");
     cmSystemTools::Error("Generator: execution of devenv failed.");
     // return to the original directory
     // return to the original directory