1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 10:47:59 +08:00

CMP0000: Remove support for OLD behavior

This commit is contained in:
Brad King
2024-11-05 09:29:58 -05:00
parent 6a1a08e634
commit e62b6cb748
5 changed files with 11 additions and 29 deletions

View File

@@ -1,6 +1,9 @@
CMP0000
-------
.. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
.. include:: REMOVED_PROLOGUE.txt
A minimum required CMake version must be specified.
CMake requires that projects specify the version of CMake to which
@@ -26,7 +29,5 @@ behavior was to silently ignore the missing invocation. The ``NEW``
behavior is to issue an error instead of a warning.
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.6.0
.. |WARNS_OR_DOES_NOT_WARN| replace:: warns
.. include:: STANDARD_ADVICE.txt
.. include:: DEPRECATED.txt
.. |WARNED_OR_DID_NOT_WARN| replace:: warned
.. include:: REMOVED_EPILOGUE.txt

View File

@@ -131,7 +131,7 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
this->PushLoopBlockBarrier();
// By default the check is not done. It is enabled by
// cmListFileCache in the top level if necessary.
// cmMakefile::Configure in the top level if necessary.
this->CheckCMP0000 = false;
#if !defined(CMAKE_BOOTSTRAP)
@@ -986,24 +986,9 @@ void cmMakefile::EnforceDirectoryLevelRules() const
"support older CMake versions for this project. "
"For more information run "
"\"cmake --help-policy CMP0000\".");
switch (this->GetPolicyStatus(cmPolicies::CMP0000)) {
case cmPolicies::WARN:
// Warn because the user did not provide a minimum required
// version.
this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING, e,
this->Backtrace);
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is to use policy version 2.4 set in
// cmListFileCache.
break;
case cmPolicies::NEW:
// NEW behavior is to issue an error.
this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
this->Backtrace);
cmSystemTools::SetFatalErrorOccurred();
break;
}
this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e,
this->Backtrace);
cmSystemTools::SetFatalErrorOccurred();
}
}

View File

@@ -15,8 +15,7 @@ class cmMakefile;
#define CM_FOR_EACH_POLICY_TABLE(POLICY, SELECT) \
SELECT(POLICY, CMP0000, \
"A minimum required CMake version must be specified.", 2, 6, 0, \
WARN) \
"A minimum required CMake version must be specified.", 2, 6, 0, NEW) \
SELECT(POLICY, CMP0001, \
"CMAKE_BACKWARDS_COMPATIBILITY should no longer be used.", 2, 6, 0, \
WARN) \

View File

@@ -3,6 +3,3 @@ cmake_minimum_required(VERSION 3.31)
# Make sure a policy set differently by our includer is now correct.
cmake_policy(GET CMP0180 cmp)
check(CMP0180 "NEW" "${cmp}")
# Test allowing the top-level file to not have cmake_minimum_required.
cmake_policy(SET CMP0000 OLD)

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.30)
project(PolicyScope C)
# No cmake_minimum_required(VERSION), it's in FindFoo.
#-----------------------------------------------------------------------------
# Helper function to report results.