소스 검색

Autogen: Deprecation message for CMAKE_AUTOMOC_RELAXED_MODE

`CMAKE_AUTOMOC_RELAXED_MODE` was added for backwards compatibility with KDE 4,
which had its last release in 2014.  It does not offer additional features
but complicates the `AUTOMOC` code and dependency computation considerably.

Projects that use `CMAKE_AUTOMOC_RELAXED_MODE` functionality always got
extensive warnings during builds and tips on how to convert to regular mode,
which is trivial (see commit e474dcb231, CMake 2.8.7).

It's time to consider this feature deprecated and issue a warning at
configuration time as well.

This adds a configuration time deprecation `AUTHOR_WARNING` for
`CMAKE_AUTOMOC_RELAXED_MODE`.
Sebastian Holtermann 6 년 전
부모
커밋
b5ad572ac1
2개의 변경된 파일17개의 추가작업 그리고 4개의 파일을 삭제
  1. 13 0
      Source/cmQtAutoGenInitializer.cxx
  2. 4 4
      Source/cmQtAutoMocUic.cxx

+ 13 - 0
Source/cmQtAutoGenInitializer.cxx

@@ -407,6 +407,19 @@ bool cmQtAutoGenInitializer::InitCustomTargets()
         }
         }
       }
       }
     }
     }
+
+    // CMAKE_AUTOMOC_RELAXED_MODE deprecation warning
+    if (this->Moc.Enabled) {
+      if (cmSystemTools::IsOn(
+            makefile->GetDefinition("CMAKE_AUTOMOC_RELAXED_MODE"))) {
+        std::string msg = "AUTOMOC: CMAKE_AUTOMOC_RELAXED_MODE is "
+                          "deprecated an will be removed in the future.  ";
+        msg += "Consider disabling it and converting the target ";
+        msg += this->Target->GetName();
+        msg += " to regular mode.";
+        makefile->IssueMessage(MessageType::AUTHOR_WARNING, msg);
+      }
+    }
   }
   }
 
 
   // Init rcc specific settings
   // Init rcc specific settings

+ 4 - 4
Source/cmQtAutoMocUic.cxx

@@ -708,7 +708,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource(
         msg += Quoted(sourceFile.FileName);
         msg += Quoted(sourceFile.FileName);
         msg += "!\nBetter include ";
         msg += "!\nBetter include ";
         msg += Quoted(sourceBase + ".moc");
         msg += Quoted(sourceBase + ".moc");
-        msg += " for compatibility with strict mode.\n";
+        msg += " for compatibility with regular mode.\n";
         msg += "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n";
         msg += "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n";
         Log().WarningFile(GenT::MOC, sourceFile.FileName, msg);
         Log().WarningFile(GenT::MOC, sourceFile.FileName, msg);
       }
       }
@@ -770,7 +770,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource(
         msg += Quoted(header->FileName);
         msg += Quoted(header->FileName);
         msg += "!\nBetter include ";
         msg += "!\nBetter include ";
         msg += Quoted("moc_" + incKey.Base + ".cpp");
         msg += Quoted("moc_" + incKey.Base + ".cpp");
-        msg += " for a compatibility with strict mode.\n";
+        msg += " for a compatibility with regular mode.\n";
         msg += "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n";
         msg += "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n";
         Log().WarningFile(GenT::MOC, sourceFile.FileName, msg);
         Log().WarningFile(GenT::MOC, sourceFile.FileName, msg);
       } else {
       } else {
@@ -782,7 +782,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource(
         msg += Quoted(header->FileName);
         msg += Quoted(header->FileName);
         msg += "!\nBetter include ";
         msg += "!\nBetter include ";
         msg += Quoted("moc_" + incKey.Base + ".cpp");
         msg += Quoted("moc_" + incKey.Base + ".cpp");
-        msg += " for compatibility with strict mode.\n";
+        msg += " for compatibility with regular mode.\n";
         msg += "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n";
         msg += "This is a CMAKE_AUTOMOC_RELAXED_MODE warning.\n";
         Log().WarningFile(GenT::MOC, sourceFile.FileName, msg);
         Log().WarningFile(GenT::MOC, sourceFile.FileName, msg);
       }
       }
@@ -797,7 +797,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource(
       // Check if this is the sources own .moc file
       // Check if this is the sources own .moc file
       bool const ownMoc = (incKey.Base == sourceBase);
       bool const ownMoc = (incKey.Base == sourceBase);
       if (!ownMoc) {
       if (!ownMoc) {
-        // Don't allow <BASE>.moc include other than own in strict mode
+        // Don't allow <BASE>.moc include other than own in regular mode
         std::string msg = "The file includes the moc file ";
         std::string msg = "The file includes the moc file ";
         msg += Quoted(incKey.Key);
         msg += Quoted(incKey.Key);
         msg += ",\nwhich seems to be the moc file from a different "
         msg += ",\nwhich seems to be the moc file from a different "