Browse Source

Merge topic 'fix-11533-vs10-custom-build-err'

66e7917 VS10: stop build on custom command error (#11533)
Brad King 15 years ago
parent
commit
1f401294d4

+ 6 - 0
Source/cmLocalVisualStudio10Generator.cxx

@@ -117,3 +117,9 @@ void cmLocalVisualStudio10Generator
                   "Stored GUID",
                   cmCacheManager::INTERNAL);
 }
+
+//----------------------------------------------------------------------------
+std::string cmLocalVisualStudio10Generator::CheckForErrorLine()
+{
+  return "if errorlevel 1 goto :VCEnd";
+}

+ 4 - 0
Source/cmLocalVisualStudio10Generator.h

@@ -36,6 +36,10 @@ public:
   virtual void Generate();
   virtual void ReadAndStoreExternalGUID(const char* name,
                                         const char* path);
+
+protected:
+  virtual std::string CheckForErrorLine();
+
 private:
 };
 #endif

+ 13 - 1
Source/cmLocalVisualStudioGenerator.cxx

@@ -148,6 +148,18 @@ void cmLocalVisualStudioGenerator::ComputeObjectNameRequirements
   this->InsertNeedObjectNames(sourceGroups, objectNameCounts);
 }
 
+//----------------------------------------------------------------------------
+std::string cmLocalVisualStudioGenerator::CheckForErrorLine()
+{
+  return "if errorlevel 1 goto :VCReportError";
+}
+
+//----------------------------------------------------------------------------
+std::string cmLocalVisualStudioGenerator::GetCheckForErrorLine()
+{
+  return this->CheckForErrorLine();
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmLocalVisualStudioGenerator
@@ -237,7 +249,7 @@ cmLocalVisualStudioGenerator
     // sequence.
     //
     script += newline_text;
-    script += "if errorlevel 1 goto VCReportError";
+    script += this->GetCheckForErrorLine();
     }
 
   return script;

+ 7 - 0
Source/cmLocalVisualStudioGenerator.h

@@ -30,6 +30,7 @@ class cmLocalVisualStudioGenerator : public cmLocalGenerator
 public:
   cmLocalVisualStudioGenerator();
   virtual ~cmLocalVisualStudioGenerator();
+
   /** Construct a script from the given list of command lines.  */
   std::string ConstructScript(const cmCustomCommandLines& commandLines,
                               const char* workingDirectory,
@@ -38,7 +39,13 @@ public:
                               bool escapeAllowMakeVars,
                               const char* newline = "\n");
 
+  /** Line of batch file text that skips to the end after
+    * a failed step in a sequence of custom commands.
+    */
+  std::string GetCheckForErrorLine();
+
 protected:
+  virtual std::string CheckForErrorLine();
 
   /** Construct a custom command to make exe import lib dir.  */
   cmsys::auto_ptr<cmCustomCommand>