Explorar o código

automoc: better error handling (#13299)

automoc now fails immediately if moc fails, instead of continuing
and letting the build fail later on.

Alex
Alex Neundorf %!s(int64=13) %!d(string=hai) anos
pai
achega
e4a2d5f9ee
Modificáronse 2 ficheiros con 6 adicións e 5 borrados
  1. 4 3
      Source/cmQtAutomoc.cxx
  2. 2 2
      Source/cmake.cxx

+ 4 - 3
Source/cmQtAutomoc.cxx

@@ -245,6 +245,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
 
 bool cmQtAutomoc::Run(const char* targetDirectory)
 {
+  bool success = true;
   cmake cm;
   cmGlobalGenerator* gg = this->CreateGlobalGenerator(&cm, targetDirectory);
   cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile();
@@ -256,7 +257,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
 
   if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
     {
-    this->RunAutomoc();
+    success = this->RunAutomoc();
     }
 
   this->WriteOldMocDefinitionsFile(targetDirectory);
@@ -264,7 +265,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
   delete gg;
   gg = NULL;
   makefile = NULL;
-  return true;
+  return success;
 }
 
 
@@ -578,7 +579,7 @@ bool cmQtAutomoc::RunAutomoc()
 
   if (this->RunMocFailed)
     {
-    std::cerr << "returning failed.."<< std::endl;
+    std::cerr << "moc failed..."<< std::endl;
     return false;
     }
   outStream.flush();

+ 2 - 2
Source/cmake.cxx

@@ -1699,8 +1699,8 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
     else if (args[1] == "cmake_automoc")
       {
         cmQtAutomoc automoc;
-        automoc.Run(args[2].c_str());
-        return 0;
+        bool automocSuccess = automoc.Run(args[2].c_str());
+        return automocSuccess ? 0 : 1;
       }
 #endif