Sfoglia il codice sorgente

ENH: Added call to StopBuild VS macro when projects fail to regenerate during a build.

Brad King 18 anni fa
parent
commit
3b59c7b97a
2 ha cambiato i file con 19 aggiunte e 0 eliminazioni
  1. 18 0
      Source/cmake.cxx
  2. 1 0
      Source/cmake.h

+ 18 - 0
Source/cmake.cxx

@@ -530,6 +530,10 @@ void cmake::SetArgs(const std::vector<std::string>& args)
       {
       this->CheckStampFile = args[++i];
       }
+    else if((i < args.size()-1) && (arg.find("--vs-solution-file",0) == 0))
+      {
+      this->VSSolutionFile = args[++i];
+      }
     else if(arg.find("-V",0) == 0)
       {
         this->Verbose = true;
@@ -2099,6 +2103,20 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
   int ret = this->Configure();
   if (ret || this->ScriptMode)
     {
+    if(!this->VSSolutionFile.empty() && this->GlobalGenerator)
+      {
+      // CMake is running to regenerate a Visual Studio build tree
+      // during a build from the VS IDE.  The build files cannot be
+      // regenerated, so we should stop the build.
+      cmSystemTools::Message(
+        "CMake Configure step failed.  "
+        "Build files cannot be regenerated correctly.  "
+        "Attempting to stop IDE build.");
+      cmGlobalVisualStudioGenerator* gg =
+        static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator);
+      gg->CallVisualStudioMacro(cmGlobalVisualStudioGenerator::MacroStop,
+                                this->VSSolutionFile.c_str());
+      }
     return ret;
     }
   ret = this->Generate();

+ 1 - 0
Source/cmake.h

@@ -402,6 +402,7 @@ private:
   std::string CCEnvironment;
   std::string CheckBuildSystemArgument;
   std::string CheckStampFile;
+  std::string VSSolutionFile;
   std::string CTestCommand;
   std::string CPackCommand;
   bool ClearBuildSystem;