diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-06-12 16:38:33 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-06-12 16:38:33 (GMT) |
commit | 0a4af0735f2aeec74a723dd6af31db585f1b664e (patch) | |
tree | bf4ab5b590350d3f2203de3b797897ffb37b6596 /Source/cmake.cxx | |
parent | d6e99fa8345f07a72308b8b33f4a31aa7fe9a0fd (diff) | |
download | CMake-0a4af0735f2aeec74a723dd6af31db585f1b664e.zip CMake-0a4af0735f2aeec74a723dd6af31db585f1b664e.tar.gz CMake-0a4af0735f2aeec74a723dd6af31db585f1b664e.tar.bz2 |
cmake: Issue message independent of cmMakefile definition
The makefile is only used when called by the cmMessageCommand, so inline
the use of it there. It otherwise creates an undesirable dependency on
cmMakefile for issuing messages in the cmake instance, a violation of
the Interface Segregation Principle.
https://en.wikipedia.org/wiki/Interface_segregation_principle
This also makes it more explicit that the variable definitions only
affect the message() command. If an AUTHOR_WARNING is issued for any
other reason, it is not affected. To affect that, it is necessary to
set the cache variable instead of the regular variable.
This is an unfortunate interface quirk, but one which can't be fixed
easily now.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 60 |
1 files changed, 17 insertions, 43 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index ecbdc61..98ac518 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2447,19 +2447,11 @@ void cmake::RunCheckForUnusedVariables() #endif } -bool cmake::GetSuppressDevWarnings(cmMakefile const* mf) const -{ - /* - * 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->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); - return cmSystemTools::IsOn(cacheEntryValue); - } +bool cmake::GetSuppressDevWarnings() const +{ + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + return cmSystemTools::IsOn(cacheEntryValue); } void cmake::SetSuppressDevWarnings(bool b) @@ -2481,20 +2473,11 @@ void cmake::SetSuppressDevWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetSuppressDeprecatedWarnings(cmMakefile const* mf) const +bool cmake::GetSuppressDeprecatedWarnings() const { - /* - * 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); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } void cmake::SetSuppressDeprecatedWarnings(bool b) @@ -2516,16 +2499,11 @@ void cmake::SetSuppressDeprecatedWarnings(bool b) cmState::INTERNAL); } -bool cmake::GetDevWarningsAsErrors(cmMakefile const* mf) const +bool cmake::GetDevWarningsAsErrors() const { - if (mf) { - return (mf->IsSet("CMAKE_SUPPRESS_DEVELOPER_ERRORS") && - !mf->IsOn("CMAKE_SUPPRESS_DEVELOPER_ERRORS")); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); - return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_SUPPRESS_DEVELOPER_ERRORS"); + return cacheEntryValue && cmSystemTools::IsOff(cacheEntryValue); } void cmake::SetDevWarningsAsErrors(bool b) @@ -2547,15 +2525,11 @@ void cmake::SetDevWarningsAsErrors(bool b) cmState::INTERNAL); } -bool cmake::GetDeprecatedWarningsAsErrors(cmMakefile const* mf) const +bool cmake::GetDeprecatedWarningsAsErrors() const { - if (mf) { - return mf->IsOn("CMAKE_ERROR_DEPRECATED"); - } else { - const char* cacheEntryValue = - this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); - return cmSystemTools::IsOn(cacheEntryValue); - } + const char* cacheEntryValue = + this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); + return cmSystemTools::IsOn(cacheEntryValue); } void cmake::SetDeprecatedWarningsAsErrors(bool b) |