diff options
author | Michael Scott <michael.scott250@gmail.com> | 2015-11-29 13:34:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-12-01 15:22:51 (GMT) |
commit | aac633d5e5765bb6b51e31364325ae7d916f021c (patch) | |
tree | e7cd3773e3936f6af088416645cb6cde7992fc2d /Source | |
parent | e8974b62d7883adf100d4c6ad90a0fbf682aaa91 (diff) | |
download | CMake-aac633d5e5765bb6b51e31364325ae7d916f021c.zip CMake-aac633d5e5765bb6b51e31364325ae7d916f021c.tar.gz CMake-aac633d5e5765bb6b51e31364325ae7d916f021c.tar.bz2 |
Explicitly enable deprecated warnings by default.
Explicitly enable deprecated warnings by default, via the
cmake::GetSuppressDeprecatedWarnings method, which signals
suppression is turned off unless the CMake variables are set
as required.
Add tests and update the documentation for the new
functionality.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmMessageCommand.cxx | 14 | ||||
-rw-r--r-- | Source/cmake.cxx | 24 | ||||
-rw-r--r-- | Source/cmake.h | 7 |
3 files changed, 36 insertions, 9 deletions
diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index fd0345d..8272eb0 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -66,13 +66,17 @@ bool cmMessageCommand fatal = true; type = cmake::DEPRECATION_ERROR; } - else if (this->Makefile->IsOn("CMAKE_WARN_DEPRECATED")) - { - type = cmake::DEPRECATION_WARNING; - } else { - return true; + if (this->Makefile->GetCMakeInstance()->GetSuppressDeprecatedWarnings( + this->Makefile)) + { + return true; + } + else + { + type = cmake::DEPRECATION_WARNING; + } } ++i; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 6481c78..c0a1196 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2581,10 +2581,7 @@ bool cmake::IsMessageTypeVisible(cmake::MessageType t) } 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)) + if (this->GetSuppressDeprecatedWarnings()) { isVisible = false; } @@ -2916,3 +2913,22 @@ bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) return cmSystemTools::IsOn(cacheEntryValue); } } + +bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) +{ + /* + * The suppression CMake variable may be set in the CMake configuration file + * itself, so we have to check what its set to in the makefile if we can. + */ + if (mf) + { + return (mf->IsSet("CMAKE_WARN_DEPRECATED") && + !mf->IsOn("CMAKE_WARN_DEPRECATED")); + } + else + { + const char* cacheEntryValue = this->State->GetCacheEntryValue( + "CMAKE_WARN_DEPRECATED"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); + } +} diff --git a/Source/cmake.h b/Source/cmake.h index 8739b87..4c5515b 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -316,6 +316,13 @@ class cmake */ bool GetSuppressDevWarnings(cmMakefile const* mf = NULL); + /* + * Get the state of the suppression of deprecated warnings. + * Returns false, by default, if deprecated warnings should be shown, true + * otherwise. + */ + bool GetSuppressDeprecatedWarnings(cmMakefile const* mf = NULL); + /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace(), |