ソースを参照

ENH: Add option to ignore errors. Only works on make

Andy Cedilnik 20 年 前
コミット
61d0a75d11

+ 10 - 9
Source/cmGlobalGenerator.cxx

@@ -651,7 +651,8 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
 }
 
 std::string cmGlobalGenerator::GenerateBuildCommand(const char* makeProgram,
-  const char *projectName, const char *targetName, const char* config)
+  const char *projectName, const char *targetName, const char* config,
+  bool ignoreErrors)
 {
   // Project name and config are not used yet.
   (void)projectName;
@@ -659,20 +660,20 @@ std::string cmGlobalGenerator::GenerateBuildCommand(const char* makeProgram,
 
   std::string makeCommand = makeProgram;
   makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str());
-  makeCommand += " ";
   // Since we have full control over the invocation of nmake, let us
   // make it quiet.
   if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
     {
-    makeCommand += "/NOLOGO ";
+    makeCommand += " /NOLOGO ";
     }
-  if ( targetName )
+  if ( ignoreErrors )
     {
-    makeCommand += targetName;
+    makeCommand += " -i";
     }
-  else
+  if ( targetName )
     {
-    makeCommand += "all";
+    makeCommand += " ";
+    makeCommand += targetName;
     }
   return makeCommand;
 }
@@ -701,7 +702,7 @@ int cmGlobalGenerator::Build(
   // should we do a clean first?
   if (clean)
     {
-    std::string cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, "clean", config);
+    std::string cleanCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, "clean", config, false);
     if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), output, 
                                          &retVal, 0, false, timeout))
       {
@@ -719,7 +720,7 @@ int cmGlobalGenerator::Build(
     }
   
   // now build
-  std::string makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, target, config);
+  std::string makeCommand = this->GenerateBuildCommand(makeCommandCSTR, projectName, target, config, false);
 
   if (!cmSystemTools::RunSingleCommand(makeCommand.c_str(), output, 
                                        &retVal, 0, false, timeout))

+ 1 - 1
Source/cmGlobalGenerator.h

@@ -99,7 +99,7 @@ public:
                     const char *makeProgram, const char *config,
                     bool clean);
   virtual std::string GenerateBuildCommand(const char* makeProgram, const char *projectName, const char *targetName,
-                    const char* config);
+                    const char* config, bool ignoreErrors);
 
   ///! Set the CMake instance
   void SetCMakeInstance(cmake *cm) {

+ 5 - 2
Source/cmGlobalVisualStudio6Generator.cxx

@@ -67,9 +67,12 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
     }
 }
 
-std::string cmGlobalVisualStudio6Generator::GenerateBuildCommand(const char* makeProgram, const char *projectName, const char *targetName,
-                    const char* config)
+std::string cmGlobalVisualStudio6Generator::GenerateBuildCommand(const char* makeProgram,
+  const char *projectName, const char *targetName, const char* config, bool ignoreErrors)
 {
+  // Ingoring errors is not implemented in visual studio 6
+  (void) ignoreErrors;
+
   // now build the test
   std::vector<std::string> mp;
   mp.push_back("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\6.0\\Setup;VsCommonDir]/MSDev98/Bin");

+ 2 - 1
Source/cmGlobalVisualStudio6Generator.h

@@ -55,7 +55,8 @@ public:
    * loaded commands, not as part of the usual build process.
    */
   virtual std::string GenerateBuildCommand(const char* makeProgram,
-    const char *projectName, const char *targetName, const char* config);
+    const char *projectName, const char *targetName, const char* config,
+    bool ignoreErrors);
 
   /**
    * Generate the all required files for building this project/tree. This

+ 5 - 1
Source/cmGlobalVisualStudio7Generator.cxx

@@ -43,8 +43,12 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(std::vector<std::string>cons
   this->cmGlobalGenerator::EnableLanguage(lang, mf);
 }
 
-std::string cmGlobalVisualStudio7Generator::GenerateBuildCommand(const char* makeProgram, const char *projectName, const char *targetName, const char* config)
+std::string cmGlobalVisualStudio7Generator::GenerateBuildCommand(const char* makeProgram,
+  const char *projectName, const char *targetName, const char* config, bool ignoreErrors)
 {
+  // Ingoring errors is not implemented in visual studio 6
+  (void) ignoreErrors;
+
   // now build the test
   std::string makeCommand = 
     cmSystemTools::ConvertToOutputPath(makeProgram);

+ 2 - 1
Source/cmGlobalVisualStudio7Generator.h

@@ -54,7 +54,8 @@ public:
    * loaded commands, not as part of the usual build process.
    */
   virtual std::string GenerateBuildCommand(const char* makeProgram,
-    const char *projectName, const char *targetName, const char* config);
+    const char *projectName, const char *targetName, const char* config,
+    bool ignoreErrors);
 
   /**
    * Generate the all required files for building this project/tree. This

+ 2 - 1
Source/cmGlobalXCodeGenerator.cxx

@@ -52,7 +52,8 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
 
 //----------------------------------------------------------------------------
 std::string cmGlobalXCodeGenerator::GenerateBuildCommand(const char* makeProgram,
-  const char *projectName, const char *targetName, const char* config)
+  const char *projectName, const char *targetName, const char* config,
+  bool ignoreErrors)
 {
   // Config is not used yet
   (void) config;

+ 2 - 1
Source/cmGlobalXCodeGenerator.h

@@ -58,7 +58,8 @@ public:
    * loaded commands, not as part of the usual build process.
    */
   virtual std::string GenerateBuildCommand(const char* makeProgram,
-    const char *projectName, const char *targetName, const char* config);
+    const char *projectName, const char *targetName, const char* config,
+    bool ignoreErrors);
 
   /**
    * Generate the all required files for building this project/tree. This