From b5ad572ac181c6e9754e31bd907abe59e7016d8a Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 27 May 2019 12:30:45 +0200 Subject: 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`. --- Source/cmQtAutoGenInitializer.cxx | 13 +++++++++++++ Source/cmQtAutoMocUic.cxx | 8 ++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 2d12964..265daf6 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/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 diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index dbabba0..889f47d 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -708,7 +708,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource( msg += Quoted(sourceFile.FileName); msg += "!\nBetter include "; 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"; Log().WarningFile(GenT::MOC, sourceFile.FileName, msg); } @@ -770,7 +770,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource( msg += Quoted(header->FileName); msg += "!\nBetter include "; 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"; Log().WarningFile(GenT::MOC, sourceFile.FileName, msg); } else { @@ -782,7 +782,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource( msg += Quoted(header->FileName); msg += "!\nBetter include "; 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"; Log().WarningFile(GenT::MOC, sourceFile.FileName, msg); } @@ -797,7 +797,7 @@ bool cmQtAutoMocUic::JobEvaluateT::MocEvalSource( // Check if this is the sources own .moc file bool const ownMoc = (incKey.Base == sourceBase); if (!ownMoc) { - // Don't allow .moc include other than own in strict mode + // Don't allow .moc include other than own in regular mode std::string msg = "The file includes the moc file "; msg += Quoted(incKey.Key); msg += ",\nwhich seems to be the moc file from a different " -- cgit v0.12 From 5bf07b9cfc5fda0c9d81f90e34761eb256733785 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 27 May 2019 12:56:58 +0200 Subject: Help: Mark CMAKE_AUTOMOC_RELAXED_MODE as deprecated --- Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst b/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst index addc62d..6c0c61b 100644 --- a/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst +++ b/Help/variable/CMAKE_AUTOMOC_RELAXED_MODE.rst @@ -1,6 +1,8 @@ CMAKE_AUTOMOC_RELAXED_MODE -------------------------- +.. deprecated:: 3.15 + Switch between strict and relaxed automoc mode. By default, :prop_tgt:`AUTOMOC` behaves exactly as described in the -- cgit v0.12 From df6adb02c067a5714587365bc6ffdd90b342732c Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Mon, 27 May 2019 12:55:34 +0200 Subject: Autogen: Deprecation release notes for CMAKE_AUTOMOC_RELAXED_MODE --- Help/release/dev/cmake_automoc_relaxed_mode.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Help/release/dev/cmake_automoc_relaxed_mode.rst diff --git a/Help/release/dev/cmake_automoc_relaxed_mode.rst b/Help/release/dev/cmake_automoc_relaxed_mode.rst new file mode 100644 index 0000000..aa4772a --- /dev/null +++ b/Help/release/dev/cmake_automoc_relaxed_mode.rst @@ -0,0 +1,5 @@ +cmake_automoc_relaxed_mode +-------------------------- + +* The variable :variable:`CMAKE_AUTOMOC_RELAXED_MODE` is considered + deprecated. Support still exists but will be removed in future versions. -- cgit v0.12