On 11/13/2015 04:51 PM, Michael Scott wrote:
> Here's the original patch split up into smaller more specific patches. 
> Let me know if there's any issues or if everything's okay, so I can 
> continue with the rest of the intended changes.

Thanks.  That is much easier to review and see the purpose of each hunk.

I've revised the patches slightly.  See attached series.  In particular,
I moved the hunk below forward to "Modify dev warning options to affect
deprecated warnings", the commit where it actually becomes needed
because the default changes.

Please precede this commit with a change that includes this hunk and
an explicit change to the default.  That way we call out the change
to the default with an explicit commit that is separate from the
additional new behavior of making -Wdev affect -Wdeprecated.

Please add a Help/release/dev/cmake-W-options.rst file with release
notes for these changes.  Mention the change in default deprecation
warnings in the release notes.  Look back at commit c96fe0b4 for the
release notes we almost used for 3.4.

The current caching logic still needs some work.  It looks like both
CMAKE_WARN_DEPRECATED and CMAKE_SUPPRESS_DEVELOPER_WARNINGS end up
in the cache right now even if no explicit options were given.  This
means that adding "-Wno-dev" on a non-initial configuration will not
disable deprecation warnings because CMAKE_WARN_DEPRECATED is already
cached even though no explicit -W option was given before.  Please
revise the logic so that these variables are cached only if the
corresponding options are explicitly set.

Also I'm not sure what to do about persistence of the option check
boxes in cmake-gui when selecting a different build tree.  As a user
I may expect those options to be loaded from the current cache in each
build tree I select.

Thanks,
-Brad

diff --git a/Tests/RunCMake/message/nomessage.cmake 
b/Tests/RunCMake/message/nomessage.cmake
index 582ab4d..0ff951a 100644
--- a/Tests/RunCMake/message/nomessage.cmake
+++ b/Tests/RunCMake/message/nomessage.cmake
@@ -1,3 +1,4 @@
+set(CMAKE_WARN_DEPRECATED OFF)

 message(DEPRECATION "This is not issued")

>From abbeb16c47e05c97653cd2c4f854653b83e32e2a Mon Sep 17 00:00:00 2001
Message-Id: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 1 Nov 2015 16:05:15 +0000
Subject: [PATCH 1/8] Tests: Revise message in RunCMake.CommandLine -Wdev case

Use more prose-like capitalization.
---
 Tests/RunCMake/CommandLine/Wdev-stderr.txt | 2 +-
 Tests/RunCMake/CommandLine/Wdev.cmake      | 2 +-
 Tests/RunCMake/CommandLine/Wno-dev.cmake   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/Tests/RunCMake/CommandLine/Wdev-stderr.txt b/Tests/RunCMake/CommandLine/Wdev-stderr.txt
index 92c1d23..88cfb3a 100644
--- a/Tests/RunCMake/CommandLine/Wdev-stderr.txt
+++ b/Tests/RunCMake/CommandLine/Wdev-stderr.txt
@@ -1,5 +1,5 @@
 ^CMake Warning \(dev\) at Wdev.cmake:1 \(message\):
-  Some Author Warning
+  Some author warning
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
 This warning is for project developers.  Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/CommandLine/Wdev.cmake b/Tests/RunCMake/CommandLine/Wdev.cmake
index e5026ef..756f31e 100644
--- a/Tests/RunCMake/CommandLine/Wdev.cmake
+++ b/Tests/RunCMake/CommandLine/Wdev.cmake
@@ -1,4 +1,4 @@
-message(AUTHOR_WARNING "Some Author Warning")
+message(AUTHOR_WARNING "Some author warning")
 
 # with -Wdev this will also cause an AUTHOR_WARNING message, checks that
 # messages issued outside of the message command, by other CMake commands, also
diff --git a/Tests/RunCMake/CommandLine/Wno-dev.cmake b/Tests/RunCMake/CommandLine/Wno-dev.cmake
index d81b858..802b435 100644
--- a/Tests/RunCMake/CommandLine/Wno-dev.cmake
+++ b/Tests/RunCMake/CommandLine/Wno-dev.cmake
@@ -1,4 +1,4 @@
-message(AUTHOR_WARNING "Some Author Warning")
+message(AUTHOR_WARNING "Some author warning")
 
 # without -Wno-dev this will also cause an AUTHOR_WARNING message, checks that
 # messages issued outside of the message command, by other CMake commands, also
-- 
2.6.2

>From 4b04e612d35d16df9a7eb469f2c3610877430230 Mon Sep 17 00:00:00 2001
Message-Id: <4b04e612d35d16df9a7eb469f2c3610877430230.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 8 Nov 2015 12:20:47 +0000
Subject: [PATCH 2/8] Make message suppression more consistent.

Make the message suppression more consistent, by adding a check
for the message related CMake variables in cmake::IssueMessage,
which allows callers of IssueMessage other than the message
command to behave as expected. Also added a check for
CMAKE_SUPPRESS_DEVELOPER_WARNINGS in the message command to
mirror the deprecated message type behaviour.

Added a 'force' flag to the cmake::IssueMessage method, to
make the message suppression consistent, when setting the
message related CMake variables directly in a CMake file.

Expand message command tests to cover the AUTHOR_WARNING message
type as well.
---
 Source/cmMakefile.cxx                         |  8 +--
 Source/cmMakefile.h                           |  3 +-
 Source/cmMessageCommand.cxx                   | 12 ++++-
 Source/cmake.cxx                              | 70 ++++++++++++++++++++++-----
 Source/cmake.h                                | 12 ++++-
 Tests/RunCMake/message/nomessage.cmake        |  4 ++
 Tests/RunCMake/message/warnmessage-stderr.txt | 11 ++++-
 Tests/RunCMake/message/warnmessage.cmake      |  6 ++-
 8 files changed, 102 insertions(+), 24 deletions(-)

diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 4fb4579..11e28c9 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -105,7 +105,8 @@ cmMakefile::~cmMakefile()
 
 //----------------------------------------------------------------------------
 void cmMakefile::IssueMessage(cmake::MessageType t,
-                              std::string const& text) const
+                              std::string const& text,
+                              bool force) const
 {
   // Collect context information.
   if(!this->ExecutionStatusStack.empty())
@@ -114,7 +115,8 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
       {
       this->ExecutionStatusStack.back()->SetNestedError(true);
       }
-    this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace());
+    this->GetCMakeInstance()->IssueMessage(t, text, this->GetBacktrace(),
+                                           force);
     }
   else
     {
@@ -129,7 +131,7 @@ void cmMakefile::IssueMessage(cmake::MessageType t,
       lfc.FilePath = converter.Convert(lfc.FilePath, cmOutputConverter::HOME);
       }
     lfc.Line = 0;
-    this->GetCMakeInstance()->IssueMessage(t, text, lfc);
+    this->GetCMakeInstance()->IssueMessage(t, text, lfc, force);
     }
 }
 
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index f1dd374..9cbbb31 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -713,7 +713,8 @@ public:
   };
 
   void IssueMessage(cmake::MessageType t,
-                    std::string const& text) const;
+                    std::string const& text,
+                    bool force = false) const;
 
   /** Set whether or not to report a CMP0000 violation.  */
   void SetCheckCMP0000(bool b) { this->CheckCMP0000 = b; }
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx
index 2854a82..1c65ef7 100644
--- a/Source/cmMessageCommand.cxx
+++ b/Source/cmMessageCommand.cxx
@@ -43,7 +43,14 @@ bool cmMessageCommand
     }
   else if (*i == "AUTHOR_WARNING")
     {
-    type = cmake::AUTHOR_WARNING;
+    if (this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"))
+      {
+      return true;
+      }
+    else
+      {
+      type = cmake::AUTHOR_WARNING;
+      }
     ++i;
     }
   else if (*i == "STATUS")
@@ -73,7 +80,8 @@ bool cmMessageCommand
 
   if (type != cmake::MESSAGE)
     {
-    this->Makefile->IssueMessage(type, message);
+    // we've overriden the message type, above, so force IssueMessage to use it
+    this->Makefile->IssueMessage(type, message, true);
     }
   else
     {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index d5bc3d2..0a5b8fb 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2471,6 +2471,45 @@ static bool cmakeCheckStampList(const char* stampList)
   return true;
 }
 
+bool cmake::IsMessageTypeVisible(cmake::MessageType t)
+{
+  bool isVisible = true;
+
+  if(t == cmake::DEPRECATION_ERROR)
+    {
+    // if CMAKE_ERROR_DEPRECATED is on, show the message, otherwise suppress it
+    const char* errorDeprecated = this->State->GetCacheEntryValue(
+                                                "CMAKE_ERROR_DEPRECATED");
+    if(cmSystemTools::IsOff(errorDeprecated))
+      {
+      isVisible = false;
+      }
+    }
+  else if (t == cmake::DEPRECATION_WARNING)
+    {
+    // if CMAKE_WARN_DEPRECATED is on, show the message, otherwise suppress it
+    const char* warnDeprecated = this->State->GetInitializedCacheValue(
+                                            "CMAKE_WARN_DEPRECATED");
+    if(cmSystemTools::IsOff(warnDeprecated))
+      {
+      isVisible = false;
+      }
+    }
+  else if (t == cmake::AUTHOR_WARNING)
+    {
+    // if CMAKE_SUPPRESS_DEVELOPER_WARNINGS is on, suppress the message,
+    // otherwise show it
+    const char* suppressDevWarnings = this->State->GetCacheEntryValue(
+                                          "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
+    if(cmSystemTools::IsOn(suppressDevWarnings))
+      {
+      isVisible = false;
+      }
+    }
+
+  return isVisible;
+}
+
 bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg)
 {
   // Construct the message header.
@@ -2494,20 +2533,13 @@ bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg)
     {
     msg << "CMake Deprecation Warning";
     }
+  else if (t == cmake::AUTHOR_WARNING)
+    {
+    msg << "CMake Warning (dev)";
+    }
   else
     {
     msg << "CMake Warning";
-    if(t == cmake::AUTHOR_WARNING)
-      {
-      // Allow suppression of these warnings.
-      const char* suppress = this->State->GetCacheEntryValue(
-                                        "CMAKE_SUPPRESS_DEVELOPER_WARNINGS");
-      if(suppress && cmSystemTools::IsOn(suppress))
-        {
-        return false;
-        }
-      msg << " (dev)";
-      }
     }
   return true;
 }
@@ -2565,10 +2597,16 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg)
 
 //----------------------------------------------------------------------------
 void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
-                         cmListFileBacktrace const& bt)
+                         cmListFileBacktrace const& bt,
+                         bool force)
 {
   cmListFileBacktrace backtrace = bt;
 
+  if (!force && !this->IsMessageTypeVisible(t))
+    {
+    return;
+    }
+
   std::ostringstream msg;
   if (!this->PrintMessagePreamble(t, msg))
     {
@@ -2588,8 +2626,14 @@ void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
 
 //----------------------------------------------------------------------------
 void cmake::IssueMessage(cmake::MessageType t, std::string const& text,
-                         cmListFileContext const& lfc)
+                         cmListFileContext const& lfc,
+                         bool force)
 {
+  if (!force && !this->IsMessageTypeVisible(t))
+    {
+    return;
+    }
+
   std::ostringstream msg;
   if (!this->PrintMessagePreamble(t, msg))
     {
diff --git a/Source/cmake.h b/Source/cmake.h
index 6b0e83f..a004758 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -304,9 +304,11 @@ class cmake
 
   /** Display a message to the user.  */
   void IssueMessage(cmake::MessageType t, std::string const& text,
-        cmListFileBacktrace const& backtrace = cmListFileBacktrace());
+        cmListFileBacktrace const& backtrace = cmListFileBacktrace(),
+        bool force = false);
   void IssueMessage(cmake::MessageType t, std::string const& text,
-        cmListFileContext const& lfc);
+        cmListFileContext const& lfc,
+        bool force = false);
 
   ///! run the --build option
   int Build(const std::string& dir,
@@ -412,6 +414,12 @@ private:
   // Print a list of valid generators to stderr.
   void PrintGeneratorList();
 
+  /*
+   * Check if messages of this type should be output, based on the state of the
+   * warning and error output CMake variables, in the cache.
+   */
+  bool IsMessageTypeVisible(cmake::MessageType t);
+
   bool PrintMessagePreamble(cmake::MessageType t, std::ostream& msg);
 };
 
diff --git a/Tests/RunCMake/message/nomessage.cmake b/Tests/RunCMake/message/nomessage.cmake
index bcc97be..582ab4d 100644
--- a/Tests/RunCMake/message/nomessage.cmake
+++ b/Tests/RunCMake/message/nomessage.cmake
@@ -1,2 +1,6 @@
 
 message(DEPRECATION "This is not issued")
+
+set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON)
+
+message(AUTHOR_WARNING "This is not issued")
diff --git a/Tests/RunCMake/message/warnmessage-stderr.txt b/Tests/RunCMake/message/warnmessage-stderr.txt
index 5c44566..e60af6e 100644
--- a/Tests/RunCMake/message/warnmessage-stderr.txt
+++ b/Tests/RunCMake/message/warnmessage-stderr.txt
@@ -1,4 +1,11 @@
-CMake Deprecation Warning at warnmessage.cmake:4 \(message\):
-  This is a warning
+^CMake Deprecation Warning at warnmessage.cmake:4 \(message\):
+  This is a deprecation warning
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
+
+
+CMake Warning \(dev\) at warnmessage.cmake:8 \(message\):
+  This is a author warning
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/message/warnmessage.cmake b/Tests/RunCMake/message/warnmessage.cmake
index 4c421a1..53f2a43 100644
--- a/Tests/RunCMake/message/warnmessage.cmake
+++ b/Tests/RunCMake/message/warnmessage.cmake
@@ -1,4 +1,8 @@
 
 set(CMAKE_WARN_DEPRECATED ON)
 
-message(DEPRECATION "This is a warning")
+message(DEPRECATION "This is a deprecation warning")
+
+set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS OFF)
+
+message(AUTHOR_WARNING "This is a author warning")
-- 
2.6.2

>From d3c2d7c96bb04ded11142cc317b1d22d60f78ec4 Mon Sep 17 00:00:00 2001
Message-Id: <d3c2d7c96bb04ded11142cc317b1d22d60f78ec4.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 8 Nov 2015 12:59:27 +0000
Subject: [PATCH 3/8] Explicitly enable author (dev) warnings by default.

Explicitly enable author warnings by default, in
cmake::IsssueMessage. Add test cases for author and deprecated
messages displayed by default.
---
 Source/cmake.cxx                                 | 8 ++++++++
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake    | 3 +++
 Tests/RunCMake/message/RunCMakeTest.cmake        | 1 +
 Tests/RunCMake/message/defaultmessage-result.txt | 1 +
 Tests/RunCMake/message/defaultmessage-stderr.txt | 5 +++++
 Tests/RunCMake/message/defaultmessage.cmake      | 4 ++++
 6 files changed, 22 insertions(+)
 create mode 100644 Tests/RunCMake/message/defaultmessage-result.txt
 create mode 100644 Tests/RunCMake/message/defaultmessage-stderr.txt
 create mode 100644 Tests/RunCMake/message/defaultmessage.cmake

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 0a5b8fb..c31d8f7 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1566,6 +1566,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
     {
     this->AddCMakePaths();
     }
+
   // Add any cache args
   if ( !this->SetCacheArgs(args) )
     {
@@ -1573,6 +1574,13 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
     return -1;
     }
 
+  // turn on author warnings by default
+  if (!this->DoSuppressDevWarnings)
+    {
+    this->SuppressDevWarnings = false;
+    this->DoSuppressDevWarnings = true;
+    }
+
   // In script mode we terminate after running the script.
   if(this->GetWorkingMode() != NORMAL_MODE)
     {
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 2d94e29..8eaaa08 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -133,6 +133,9 @@ set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev)
 run_cmake(Wdev)
 unset(RunCMake_TEST_OPTIONS)
 
+# Dev warnings should be on by default
+run_cmake(Wdev)
+
 set(RunCMake_TEST_OPTIONS --debug-output)
 run_cmake(debug-output)
 unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake
index d2bc0c3..294dfbb 100644
--- a/Tests/RunCMake/message/RunCMakeTest.cmake
+++ b/Tests/RunCMake/message/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
 include(RunCMake)
 
+run_cmake(defaultmessage)
 run_cmake(nomessage)
 run_cmake(warnmessage)
 run_cmake(errormessage)
diff --git a/Tests/RunCMake/message/defaultmessage-result.txt b/Tests/RunCMake/message/defaultmessage-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/message/defaultmessage-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/message/defaultmessage-stderr.txt b/Tests/RunCMake/message/defaultmessage-stderr.txt
new file mode 100644
index 0000000..95656ec
--- /dev/null
+++ b/Tests/RunCMake/message/defaultmessage-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Warning \(dev\) at defaultmessage.cmake:4 \(message\):
+  This is a author warning
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+This warning is for project developers.  Use -Wno-dev to suppress it.$
diff --git a/Tests/RunCMake/message/defaultmessage.cmake b/Tests/RunCMake/message/defaultmessage.cmake
new file mode 100644
index 0000000..427014d
--- /dev/null
+++ b/Tests/RunCMake/message/defaultmessage.cmake
@@ -0,0 +1,4 @@
+
+message(DEPRECATION "This is a deprecation warning")
+
+message(AUTHOR_WARNING "This is a author warning")
-- 
2.6.2

>From f54491773f3212845de46b7da3c1f43823ba5650 Mon Sep 17 00:00:00 2001
Message-Id: <f54491773f3212845de46b7da3c1f43823ba5650.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 8 Nov 2015 20:21:38 +0000
Subject: [PATCH 4/8] Refactor the -W options parser to be generic.

Refactor the -Wdev and -Wno-dev options parser to use a generic -W
parser that follows the GCC pattern, excluding support for
-Werror=TYPE and -Wno-error=TYPE formats for now.
---
 Source/cmake.cxx                                 | 110 ++++++++++++++++-------
 Source/cmake.h                                   |  14 +--
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake    |  13 ++-
 Tests/RunCMake/CommandLine/W_bad-arg1-result.txt |   1 +
 Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt |   2 +
 Tests/RunCMake/CommandLine/W_bad-arg2-result.txt |   1 +
 Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt |   2 +
 7 files changed, 104 insertions(+), 39 deletions(-)
 create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg1-result.txt
 create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg2-result.txt
 create mode 100644 Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt

diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index c31d8f7..48ef456 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -127,8 +127,6 @@ cmake::cmake()
   this->WarnUnused = false;
   this->WarnUnusedCli = true;
   this->CheckSystemVars = false;
-  this->SuppressDevWarnings = false;
-  this->DoSuppressDevWarnings = false;
   this->DebugOutput = false;
   this->DebugTryCompile = false;
   this->ClearBuildSystem = false;
@@ -274,15 +272,52 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
         return false;
         }
       }
-    else if(arg.find("-Wno-dev",0) == 0)
+    else if(cmHasLiteralPrefix(arg, "-W"))
       {
-      this->SuppressDevWarnings = true;
-      this->DoSuppressDevWarnings = true;
-      }
-    else if(arg.find("-Wdev",0) == 0)
-      {
-      this->SuppressDevWarnings = false;
-      this->DoSuppressDevWarnings = true;
+      std::string entry = arg.substr(2);
+      if (entry.empty())
+        {
+        ++i;
+        if (i < args.size())
+          {
+          entry = args[i];
+          }
+        else
+          {
+          cmSystemTools::Error(
+            "-W must be followed with [no-]<name>.");
+          return false;
+          }
+        }
+
+      std::string name;
+      bool foundNo = false;
+      unsigned int nameStartPosition = 0;
+
+      if (entry.find("no-", nameStartPosition) == 0)
+        {
+        foundNo = true;
+        nameStartPosition += 3;
+        }
+
+      name = entry.substr(nameStartPosition);
+      if (name.empty())
+        {
+        cmSystemTools::Error("No warning name provided.");
+        return false;
+        }
+
+      if (!foundNo)
+        {
+        // -W<name>
+        this->DiagLevels[name] = std::max(this->DiagLevels[name],
+                                          DIAG_WARN);
+        }
+      else
+        {
+        // -Wno<name>
+        this->DiagLevels[name] = DIAG_IGNORE;
+        }
       }
     else if(arg.find("-U",0) == 0)
       {
@@ -618,11 +653,7 @@ void cmake::SetArgs(const std::vector<std::string>& args,
       // skip for now
       i++;
       }
-    else if(arg.find("-Wno-dev",0) == 0)
-      {
-      // skip for now
-      }
-    else if(arg.find("-Wdev",0) == 0)
+    else if(arg.find("-W",0) == 0)
       {
       // skip for now
       }
@@ -1217,25 +1248,28 @@ int cmake::HandleDeleteCacheVariables(const std::string& var)
 
 int cmake::Configure()
 {
-  if(this->DoSuppressDevWarnings)
+  DiagLevel diagLevel;
+
+  if (this->DiagLevels.count("dev") == 1)
     {
-    if(this->SuppressDevWarnings)
+
+    diagLevel = this->DiagLevels["dev"];
+    if (diagLevel == DIAG_IGNORE)
       {
-      this->
-        AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE",
-                      "Suppress Warnings that are meant for"
-                      " the author of the CMakeLists.txt files.",
-                      cmState::INTERNAL);
+      this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE",
+                          "Suppress Warnings that are meant for"
+                          " the author of the CMakeLists.txt files.",
+                          cmState::INTERNAL);
       }
-    else
+    else if (diagLevel == DIAG_WARN)
       {
-      this->
-        AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE",
-                      "Suppress Warnings that are meant for"
-                      " the author of the CMakeLists.txt files.",
-                      cmState::INTERNAL);
+      this->AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE",
+                          "Suppress Warnings that are meant for"
+                          " the author of the CMakeLists.txt files.",
+                          cmState::INTERNAL);
       }
     }
+
   int ret = this->ActualConfigure();
   const char* delCacheVars = this->State
                     ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_");
@@ -1575,10 +1609,9 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
     }
 
   // turn on author warnings by default
-  if (!this->DoSuppressDevWarnings)
+  if (this->DiagLevels.count("dev") == 0)
     {
-    this->SuppressDevWarnings = false;
-    this->DoSuppressDevWarnings = true;
+    this->DiagLevels["dev"] = DIAG_WARN;
     }
 
   // In script mode we terminate after running the script.
@@ -2801,3 +2834,18 @@ void cmake::RunCheckForUnusedVariables()
     }
 #endif
 }
+
+void cmake::SetSuppressDevWarnings(bool b)
+{
+  // equivalent to -Wno-dev
+  if (b)
+    {
+    this->DiagLevels["dev"] = DIAG_IGNORE;
+    }
+  // equivalent to -Wdev
+  else
+    {
+    this->DiagLevels["dev"] = std::max(this->DiagLevels["dev"],
+                                       DIAG_WARN);
+    }
+}
diff --git a/Source/cmake.h b/Source/cmake.h
index a004758..c4a6a43 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -68,6 +68,11 @@ class cmake
     DEPRECATION_WARNING
   };
 
+  enum DiagLevel
+  {
+    DIAG_IGNORE,
+    DIAG_WARN
+  };
 
   /** \brief Describes the working modes of cmake */
   enum WorkingMode
@@ -296,11 +301,7 @@ class cmake
   std::string const& GetCMakeEditCommand() const
     { return this->CMakeEditCommand; }
 
-  void SetSuppressDevWarnings(bool v)
-    {
-      this->SuppressDevWarnings = v;
-      this->DoSuppressDevWarnings = true;
-    }
+  void SetSuppressDevWarnings(bool b);
 
   /** Display a message to the user.  */
   void IssueMessage(cmake::MessageType t, std::string const& text,
@@ -346,8 +347,7 @@ protected:
 
   cmGlobalGenerator *GlobalGenerator;
   cmCacheManager *CacheManager;
-  bool SuppressDevWarnings;
-  bool DoSuppressDevWarnings;
+  std::map<std::string, DiagLevel> DiagLevels;
   std::string GeneratorPlatform;
   std::string GeneratorToolset;
 
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index 8eaaa08..d4f399c 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -129,13 +129,24 @@ set(RunCMake_TEST_OPTIONS -Wno-dev)
 run_cmake(Wno-dev)
 unset(RunCMake_TEST_OPTIONS)
 
-set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev)
+set(RunCMake_TEST_OPTIONS -Wdev)
 run_cmake(Wdev)
 unset(RunCMake_TEST_OPTIONS)
 
 # Dev warnings should be on by default
 run_cmake(Wdev)
 
+# Conflicting -W options should honor the last value
+set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev)
+run_cmake(Wdev)
+unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Wdev -Wno-dev)
+run_cmake(Wno-dev)
+unset(RunCMake_TEST_OPTIONS)
+
+run_cmake_command(W_bad-arg1 ${CMAKE_COMMAND} -W)
+run_cmake_command(W_bad-arg2 ${CMAKE_COMMAND} -Wno-)
+
 set(RunCMake_TEST_OPTIONS --debug-output)
 run_cmake(debug-output)
 unset(RunCMake_TEST_OPTIONS)
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt
new file mode 100644
index 0000000..0c0f613
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg1-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: -W must be followed with \[no-\]<name>.
+CMake Error: Problem processing arguments. Aborting.
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt
new file mode 100644
index 0000000..cc643df
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/W_bad-arg2-stderr.txt
@@ -0,0 +1,2 @@
+CMake Error: No warning name provided.
+CMake Error: Problem processing arguments. Aborting.
-- 
2.6.2

>From 9fd3625aeffbd169aa7d8148d5204e113809be0a Mon Sep 17 00:00:00 2001
Message-Id: <9fd3625aeffbd169aa7d8148d5204e113809be0a.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 8 Nov 2015 23:06:33 +0000
Subject: [PATCH 5/8] Add -W options to control deprecated warning messages.

Add 'deprecated' warning options type, to allow setting
CMAKE_WARN_DEPRECATED via the -W '-Wdeprecated' and
'-Wno-deprecated' options.

Add tests for new options and updated documentation.
---
 Help/manual/OPTIONS_BUILD.txt                     | 12 ++++++++++++
 Help/variable/CMAKE_WARN_DEPRECATED.rst           |  9 ++++++---
 Source/cmake.cxx                                  | 21 +++++++++++++++++++++
 Source/cmake.h                                    |  4 +++-
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake     |  8 ++++++++
 Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt |  4 ++++
 Tests/RunCMake/CommandLine/Wdeprecated.cmake      |  1 +
 Tests/RunCMake/CommandLine/Wno-deprecated.cmake   |  1 +
 8 files changed, 56 insertions(+), 4 deletions(-)
 create mode 100644 Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt
 create mode 100644 Tests/RunCMake/CommandLine/Wdeprecated.cmake
 create mode 100644 Tests/RunCMake/CommandLine/Wno-deprecated.cmake

diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index 4207db4..eec138c 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -84,3 +84,15 @@
 
  Enable warnings that are meant for the author of the CMakeLists.txt
  files.
+
+``-Wdeprecated``
+ Enable deprecated functionality warnings.
+
+ Enable warnings for usage of deprecated functionality, that are meant
+ for the author of the CMakeLists.txt files.
+
+``-Wno-deprecated``
+ Suppress deprecated functionality warnings.
+
+ Suppress warnings for usage of deprecated functionality, that are meant
+ for the author of the CMakeLists.txt files.
diff --git a/Help/variable/CMAKE_WARN_DEPRECATED.rst b/Help/variable/CMAKE_WARN_DEPRECATED.rst
index 662cbd8..4a224fa 100644
--- a/Help/variable/CMAKE_WARN_DEPRECATED.rst
+++ b/Help/variable/CMAKE_WARN_DEPRECATED.rst
@@ -1,7 +1,10 @@
 CMAKE_WARN_DEPRECATED
 ---------------------
 
-Whether to issue deprecation warnings for macros and functions.
+Whether to issue warnings for deprecated functionality.
 
-If ``TRUE``, this can be used by macros and functions to issue deprecation
-warnings.  This variable is ``FALSE`` by default.
+If not ``FALSE``, use of deprecated functionality will issue warnings.
+If this variable is not set, CMake behaves as if it were set to ``TRUE``.
+
+When running :manual:`cmake(1)`, this option can be enabled with the
+``-Wdeprecated`` option, or disabled with the ``-Wno-deprecated`` option.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 48ef456..8313122 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1250,6 +1250,26 @@ int cmake::Configure()
 {
   DiagLevel diagLevel;
 
+  if (this->DiagLevels.count("deprecated") == 1)
+    {
+
+    diagLevel = this->DiagLevels["deprecated"];
+    if (diagLevel == DIAG_IGNORE)
+      {
+      this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE",
+                          "Whether to issue deprecation warnings for"
+                          " macros and functions.",
+                          cmState::BOOL);
+      }
+    else if (diagLevel == DIAG_WARN)
+      {
+      this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE",
+                          "Whether to issue deprecation warnings for"
+                          " macros and functions.",
+                          cmState::BOOL);
+      }
+    }
+
   if (this->DiagLevels.count("dev") == 1)
     {
 
@@ -1270,6 +1290,7 @@ int cmake::Configure()
       }
     }
 
+
   int ret = this->ActualConfigure();
   const char* delCacheVars = this->State
                     ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_");
diff --git a/Source/cmake.h b/Source/cmake.h
index c4a6a43..96a778f 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -431,7 +431,9 @@ private:
   {"-T <toolset-name>", "Specify toolset name if supported by generator."}, \
   {"-A <platform-name>", "Specify platform name if supported by generator."}, \
   {"-Wno-dev", "Suppress developer warnings."},\
-  {"-Wdev", "Enable developer warnings."}
+  {"-Wdev", "Enable developer warnings."},\
+  {"-Wdeprecated", "Enable deprecation warnings."},\
+  {"-Wno-deprecated", "Suppress deprecation warnings."}
 
 #define FOR_EACH_C_FEATURE(F) \
   F(c_function_prototypes) \
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index d4f399c..f726ae2 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -133,6 +133,14 @@ set(RunCMake_TEST_OPTIONS -Wdev)
 run_cmake(Wdev)
 unset(RunCMake_TEST_OPTIONS)
 
+set(RunCMake_TEST_OPTIONS -Wdeprecated)
+run_cmake(Wdeprecated)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS -Wno-deprecated)
+run_cmake(Wno-deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
 # Dev warnings should be on by default
 run_cmake(Wdev)
 
diff --git a/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt
new file mode 100644
index 0000000..e9be1dc
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wdeprecated-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Deprecation Warning at Wdeprecated.cmake:1 \(message\):
+  Some deprecated warning
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/CommandLine/Wdeprecated.cmake b/Tests/RunCMake/CommandLine/Wdeprecated.cmake
new file mode 100644
index 0000000..3142b42
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wdeprecated.cmake
@@ -0,0 +1 @@
+message(DEPRECATION "Some deprecated warning")
diff --git a/Tests/RunCMake/CommandLine/Wno-deprecated.cmake b/Tests/RunCMake/CommandLine/Wno-deprecated.cmake
new file mode 100644
index 0000000..3142b42
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/Wno-deprecated.cmake
@@ -0,0 +1 @@
+message(DEPRECATION "Some deprecated warning")
-- 
2.6.2

>From bd5db6f976ec4a044afceaaa44711d65809eacef Mon Sep 17 00:00:00 2001
Message-Id: <bd5db6f976ec4a044afceaaa44711d65809eacef.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 8 Nov 2015 23:16:58 +0000
Subject: [PATCH 6/8] Consistent documentation for deprecation message
 variables.

Make the documentation for the 'CMAKE_ERROR_DEPRECATED' CMake
variable consistent with the documentation for the
'CMAKE_WARN_DEPRECATED' CMake variable, in terms of wording.
---
 Help/variable/CMAKE_ERROR_DEPRECATED.rst | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Help/variable/CMAKE_ERROR_DEPRECATED.rst b/Help/variable/CMAKE_ERROR_DEPRECATED.rst
index 277a4cc..f3a6738 100644
--- a/Help/variable/CMAKE_ERROR_DEPRECATED.rst
+++ b/Help/variable/CMAKE_ERROR_DEPRECATED.rst
@@ -1,8 +1,7 @@
 CMAKE_ERROR_DEPRECATED
 ----------------------
 
-Whether to issue deprecation errors for macros and functions.
+Whether to issue errors for deprecated functionality.
 
-If ``TRUE``, this can be used by macros and functions to issue fatal
-errors when deprecated macros or functions are used.  This variable is
-``FALSE`` by default.
+If ``TRUE``, use of deprecated functionality will issue fatal errors.
+If this variable is not set, CMake behaves as if it were set to ``FALSE``.
-- 
2.6.2

>From e1c5d2bff60486f320a9478c8cca162506239ea9 Mon Sep 17 00:00:00 2001
Message-Id: <e1c5d2bff60486f320a9478c8cca162506239ea9.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 8 Nov 2015 23:34:59 +0000
Subject: [PATCH 7/8] Modify dev warning options to affect deprecated warnings.

Change the '-Wdev' and '-Wno-dev' options to also enable and
suppress the deprecated warnings output, via the
'CMAKE_WARN_DEPRECATED' CMake variable, by default. This
action does not happen if the user specifies a deprecated
warning message option.

Add tests and update the documentation for the new
functionality.
---
 Help/manual/OPTIONS_BUILD.txt                    |  5 +++--
 Source/cmake.cxx                                 | 28 +++++++++++++++++++++++-
 Tests/RunCMake/CommandLine/RunCMakeTest.cmake    | 16 ++++++++++++++
 Tests/RunCMake/message/defaultmessage-stderr.txt |  8 ++++++-
 Tests/RunCMake/message/nomessage.cmake           |  1 +
 5 files changed, 54 insertions(+), 4 deletions(-)

diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index eec138c..977264c 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -77,13 +77,14 @@
  Suppress developer warnings.
 
  Suppress warnings that are meant for the author of the
- CMakeLists.txt files.
+ CMakeLists.txt files. By default this will also turn off
+ deprecation warnings.
 
 ``-Wdev``
  Enable developer warnings.
 
  Enable warnings that are meant for the author of the CMakeLists.txt
- files.
+ files. By default this will also turn on deprecation warnings.
 
 ``-Wdeprecated``
  Enable deprecated functionality warnings.
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 8313122..1863347 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1272,6 +1272,16 @@ int cmake::Configure()
 
   if (this->DiagLevels.count("dev") == 1)
     {
+    bool setDeprecatedVariables = false;
+
+    const char* cachedWarnDeprecated =
+           this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED");
+
+    // don't overwrite deprecated warning setting from a previous invocation
+    if (!cachedWarnDeprecated)
+      {
+      setDeprecatedVariables = true;
+      }
 
     diagLevel = this->DiagLevels["dev"];
     if (diagLevel == DIAG_IGNORE)
@@ -1280,6 +1290,14 @@ int cmake::Configure()
                           "Suppress Warnings that are meant for"
                           " the author of the CMakeLists.txt files.",
                           cmState::INTERNAL);
+
+      if (setDeprecatedVariables)
+        {
+        this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE",
+                            "Whether to issue deprecation warnings for"
+                            " macros and functions.",
+                            cmState::BOOL);
+        }
       }
     else if (diagLevel == DIAG_WARN)
       {
@@ -1287,6 +1305,14 @@ int cmake::Configure()
                           "Suppress Warnings that are meant for"
                           " the author of the CMakeLists.txt files.",
                           cmState::INTERNAL);
+
+      if (setDeprecatedVariables)
+        {
+        this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE",
+                            "Whether to issue deprecation warnings for"
+                            " macros and functions.",
+                            cmState::BOOL);
+        }
       }
     }
 
@@ -1629,7 +1655,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
     return -1;
     }
 
-  // turn on author warnings by default
+  // turn on author, and in turn deprecated, warnings (only) by default
   if (this->DiagLevels.count("dev") == 0)
     {
     this->DiagLevels["dev"] = DIAG_WARN;
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index f726ae2..6b4b384 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -133,6 +133,19 @@ set(RunCMake_TEST_OPTIONS -Wdev)
 run_cmake(Wdev)
 unset(RunCMake_TEST_OPTIONS)
 
+# -Wdev should not override deprecated options if specified
+set(RunCMake_TEST_OPTIONS -Wdev -Wno-deprecated)
+run_cmake(Wno-deprecated)
+unset(RunCMake_TEST_OPTIONS)
+set(RunCMake_TEST_OPTIONS -Wno-deprecated -Wdev)
+run_cmake(Wno-deprecated)
+unset(RunCMake_TEST_OPTIONS)
+
+# -Wdev should enable deprecated warnings as well
+set(RunCMake_TEST_OPTIONS -Wdev)
+run_cmake(Wdeprecated)
+unset(RunCMake_TEST_OPTIONS)
+
 set(RunCMake_TEST_OPTIONS -Wdeprecated)
 run_cmake(Wdeprecated)
 unset(RunCMake_TEST_OPTIONS)
@@ -144,6 +157,9 @@ unset(RunCMake_TEST_OPTIONS)
 # Dev warnings should be on by default
 run_cmake(Wdev)
 
+# Deprecated warnings should be on by default
+run_cmake(Wdeprecated)
+
 # Conflicting -W options should honor the last value
 set(RunCMake_TEST_OPTIONS -Wno-dev -Wdev)
 run_cmake(Wdev)
diff --git a/Tests/RunCMake/message/defaultmessage-stderr.txt b/Tests/RunCMake/message/defaultmessage-stderr.txt
index 95656ec..dd1b28f 100644
--- a/Tests/RunCMake/message/defaultmessage-stderr.txt
+++ b/Tests/RunCMake/message/defaultmessage-stderr.txt
@@ -1,4 +1,10 @@
-^CMake Warning \(dev\) at defaultmessage.cmake:4 \(message\):
+^CMake Deprecation Warning at defaultmessage.cmake:2 \(message\):
+  This is a deprecation warning
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
+
+
+CMake Warning \(dev\) at defaultmessage.cmake:4 \(message\):
   This is a author warning
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/message/nomessage.cmake b/Tests/RunCMake/message/nomessage.cmake
index 582ab4d..0ff951a 100644
--- a/Tests/RunCMake/message/nomessage.cmake
+++ b/Tests/RunCMake/message/nomessage.cmake
@@ -1,3 +1,4 @@
+set(CMAKE_WARN_DEPRECATED OFF)
 
 message(DEPRECATION "This is not issued")
 
-- 
2.6.2

>From edb97e3fb9209065850db06d2a59dd61e4ac7028 Mon Sep 17 00:00:00 2001
Message-Id: <edb97e3fb9209065850db06d2a59dd61e4ac7028.1447687388.git.brad.k...@kitware.com>
In-Reply-To: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
References: <abbeb16c47e05c97653cd2c4f854653b83e32e2a.1447687388.git.brad.k...@kitware.com>
From: Michael Scott <[email protected]>
Date: Sun, 15 Nov 2015 17:47:12 +0000
Subject: [PATCH 8/8] cmake-gui: Add option to suppress deprecation warning
 messages

Add an option to the CMake GUI to toggle suppression of deprecated
warning messages.
---
 Source/QtDialog/CMakeSetupDialog.cxx |  8 ++++++++
 Source/QtDialog/CMakeSetupDialog.h   |  1 +
 Source/QtDialog/QCMake.cxx           |  8 ++++++++
 Source/QtDialog/QCMake.h             |  3 +++
 Source/cmake.cxx                     | 15 +++++++++++++++
 Source/cmake.h                       |  1 +
 6 files changed, 36 insertions(+)

diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx
index 03417f3..61d6b1d 100644
--- a/Source/QtDialog/CMakeSetupDialog.cxx
+++ b/Source/QtDialog/CMakeSetupDialog.cxx
@@ -144,6 +144,10 @@ CMakeSetupDialog::CMakeSetupDialog()
   this->SuppressDevWarningsAction =
     OptionsMenu->addAction(tr("&Suppress dev Warnings (-Wno-dev)"));
   this->SuppressDevWarningsAction->setCheckable(true);
+  this->SuppressDeprecatedWarningsAction =
+    OptionsMenu->addAction(
+      tr("&Suppress Deprecated Warnings (-Wno-deprecated)"));
+  this->SuppressDeprecatedWarningsAction->setCheckable(true);
   this->WarnUninitializedAction =
     OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
   this->WarnUninitializedAction->setCheckable(true);
@@ -276,6 +280,10 @@ void CMakeSetupDialog::initialize()
 
   QObject::connect(this->SuppressDevWarningsAction, SIGNAL(triggered(bool)),
                    this->CMakeThread->cmakeInstance(), SLOT(setSuppressDevWarnings(bool)));
+  QObject::connect(this->SuppressDeprecatedWarningsAction,
+                   SIGNAL(triggered(bool)),
+                   this->CMakeThread->cmakeInstance(),
+                   SLOT(setSuppressDeprecatedWarnings(bool)));
 
   QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
                    this->CMakeThread->cmakeInstance(),
diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h
index 1b26c64..6cc8de3 100644
--- a/Source/QtDialog/CMakeSetupDialog.h
+++ b/Source/QtDialog/CMakeSetupDialog.h
@@ -102,6 +102,7 @@ protected:
   QAction* ConfigureAction;
   QAction* GenerateAction;
   QAction* SuppressDevWarningsAction;
+  QAction* SuppressDeprecatedWarningsAction;
   QAction* WarnUninitializedAction;
   QAction* WarnUnusedAction;
   QAction* InstallForCommandLineAction;
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 9edbb20..c1c7005 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -28,6 +28,7 @@ QCMake::QCMake(QObject* p)
   : QObject(p)
 {
   this->SuppressDevWarnings = false;
+  this->SuppressDeprecatedWarnings = false;
   this->WarnUninitializedMode = false;
   this->WarnUnusedMode = false;
   qRegisterMetaType<QCMakeProperty>();
@@ -151,6 +152,8 @@ void QCMake::configure()
   this->CMakeInstance->SetGeneratorToolset("");
   this->CMakeInstance->LoadCache();
   this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
+  this->CMakeInstance->SetSuppressDeprecatedWarnings(
+    this->SuppressDeprecatedWarnings);
   this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
   this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode);
   this->CMakeInstance->PreLoadCMakeFiles();
@@ -445,6 +448,11 @@ void QCMake::setSuppressDevWarnings(bool value)
   this->SuppressDevWarnings = value;
 }
 
+void QCMake::setSuppressDeprecatedWarnings(bool value)
+{
+  this->SuppressDeprecatedWarnings = value;
+}
+
 void QCMake::setWarnUninitializedMode(bool value)
 {
   this->WarnUninitializedMode = value;
diff --git a/Source/QtDialog/QCMake.h b/Source/QtDialog/QCMake.h
index d910eb7..a50f8ae 100644
--- a/Source/QtDialog/QCMake.h
+++ b/Source/QtDialog/QCMake.h
@@ -89,6 +89,8 @@ public slots:
   void setDebugOutput(bool);
   /// set whether to do suppress dev warnings
   void setSuppressDevWarnings(bool value);
+  /// set whether to do suppress deprecated warnings
+  void setSuppressDeprecatedWarnings(bool value);
   /// set whether to run cmake with warnings about uninitialized variables
   void setWarnUninitializedMode(bool value);
   /// set whether to run cmake with warnings about unused variables
@@ -141,6 +143,7 @@ protected:
   static void stdoutCallback(const char* msg, size_t len, void* cd);
   static void stderrCallback(const char* msg, size_t len, void* cd);
   bool SuppressDevWarnings;
+  bool SuppressDeprecatedWarnings;
   bool WarnUninitializedMode;
   bool WarnUnusedMode;
   bool WarnUnusedAllMode;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1863347..3bfffd6 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -2896,3 +2896,18 @@ void cmake::SetSuppressDevWarnings(bool b)
                                        DIAG_WARN);
     }
 }
+
+void cmake::SetSuppressDeprecatedWarnings(bool b)
+{
+  // equivalent to -Wno-deprecated
+  if (b)
+    {
+    this->DiagLevels["deprecated"] = DIAG_IGNORE;
+    }
+  // equivalent to -Wdeprecated
+  else
+    {
+    this->DiagLevels["deprecated"] = std::max(this->DiagLevels["deprecated"],
+                                              DIAG_WARN);
+    }
+}
diff --git a/Source/cmake.h b/Source/cmake.h
index 96a778f..cd41d15 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -302,6 +302,7 @@ class cmake
     { return this->CMakeEditCommand; }
 
   void SetSuppressDevWarnings(bool b);
+  void SetSuppressDeprecatedWarnings(bool b);
 
   /** Display a message to the user.  */
   void IssueMessage(cmake::MessageType t, std::string const& text,
-- 
2.6.2

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to