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.
This commit is contained in:
parent
b146747ed7
commit
e8974b62d7
|
@ -77,13 +77,14 @@
|
||||||
Suppress developer warnings.
|
Suppress developer warnings.
|
||||||
|
|
||||||
Suppress warnings that are meant for the author of the
|
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``
|
``-Wdev``
|
||||||
Enable developer warnings.
|
Enable developer warnings.
|
||||||
|
|
||||||
Enable warnings that are meant for the author of the CMakeLists.txt
|
Enable warnings that are meant for the author of the CMakeLists.txt
|
||||||
files.
|
files. By default this will also turn on deprecation warnings.
|
||||||
|
|
||||||
``-Wdeprecated``
|
``-Wdeprecated``
|
||||||
Enable deprecated functionality warnings.
|
Enable deprecated functionality warnings.
|
||||||
|
|
|
@ -3,3 +3,6 @@ cmake-W-options
|
||||||
|
|
||||||
* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the
|
* The :variable:`CMAKE_WARN_DEPRECATED` variable can now be set using the
|
||||||
``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options.
|
``-Wdeprecated`` and ``-Wno-deprecated`` :manual:`cmake(1)` options.
|
||||||
|
|
||||||
|
* The ``-Wdev`` and ``-Wno-dev`` :manual:`cmake(1)` options now also enable
|
||||||
|
and suppress the deprecated warnings output by default.
|
||||||
|
|
|
@ -1285,6 +1285,16 @@ int cmake::Configure()
|
||||||
|
|
||||||
if (this->DiagLevels.count("dev") == 1)
|
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"];
|
diagLevel = this->DiagLevels["dev"];
|
||||||
if (diagLevel == DIAG_IGNORE)
|
if (diagLevel == DIAG_IGNORE)
|
||||||
|
@ -1293,6 +1303,14 @@ int cmake::Configure()
|
||||||
"Suppress Warnings that are meant for"
|
"Suppress Warnings that are meant for"
|
||||||
" the author of the CMakeLists.txt files.",
|
" the author of the CMakeLists.txt files.",
|
||||||
cmState::INTERNAL);
|
cmState::INTERNAL);
|
||||||
|
|
||||||
|
if (setDeprecatedVariables)
|
||||||
|
{
|
||||||
|
this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE",
|
||||||
|
"Whether to issue warnings for deprecated "
|
||||||
|
"functionality.",
|
||||||
|
cmState::INTERNAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (diagLevel == DIAG_WARN)
|
else if (diagLevel == DIAG_WARN)
|
||||||
{
|
{
|
||||||
|
@ -1300,6 +1318,14 @@ int cmake::Configure()
|
||||||
"Suppress Warnings that are meant for"
|
"Suppress Warnings that are meant for"
|
||||||
" the author of the CMakeLists.txt files.",
|
" the author of the CMakeLists.txt files.",
|
||||||
cmState::INTERNAL);
|
cmState::INTERNAL);
|
||||||
|
|
||||||
|
if (setDeprecatedVariables)
|
||||||
|
{
|
||||||
|
this->AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE",
|
||||||
|
"Whether to issue warnings for deprecated "
|
||||||
|
"functionality.",
|
||||||
|
cmState::INTERNAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,19 @@ set(RunCMake_TEST_OPTIONS -Wdev)
|
||||||
run_cmake(Wdev)
|
run_cmake(Wdev)
|
||||||
unset(RunCMake_TEST_OPTIONS)
|
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)
|
set(RunCMake_TEST_OPTIONS -Wdeprecated)
|
||||||
run_cmake(Wdeprecated)
|
run_cmake(Wdeprecated)
|
||||||
unset(RunCMake_TEST_OPTIONS)
|
unset(RunCMake_TEST_OPTIONS)
|
||||||
|
|
Loading…
Reference in New Issue