Remove compatibility with CMake versions older than 2.8.0
This compatibility has been deprecated since commit 5845c218d7
(Deprecate compatibility with CMake versions older than 2.8.12,
2020-06-12, v3.19.0-rc1~629^2). The behavior itself has been
deprecated since CMake 2.8.0.
Issue: #26613
This commit is contained in:
parent
35282387ea
commit
785523a136
@ -1,3 +1,11 @@
|
||||
.. versionchanged:: 4.0
|
||||
|
||||
Compatibility with versions of CMake older than 2.8.0 is removed.
|
||||
Calls to :command:`cmake_minimum_required(VERSION)` or
|
||||
:command:`cmake_policy(VERSION)` that do not specify at least
|
||||
2.8.0 as their policy version (optionally via ``...<max>``)
|
||||
will produce an error in CMake 4.0 and above.
|
||||
|
||||
.. versionchanged:: 3.31
|
||||
|
||||
Compatibility with versions of CMake older than 3.10 is deprecated.
|
||||
|
10
Help/release/dev/remove-old-compatibility.rst
Normal file
10
Help/release/dev/remove-old-compatibility.rst
Normal file
@ -0,0 +1,10 @@
|
||||
remove-old-compatibility
|
||||
------------------------
|
||||
|
||||
* Compatibility with versions of CMake older than 2.8.0 has been removed.
|
||||
Calls to :command:`cmake_minimum_required` or :command:`cmake_policy`
|
||||
that set the policy version to an older value now issue an error.
|
||||
Note that calls to those commands can still support older versions of
|
||||
CMake by using their ``VERSION`` arguments' ``<min>...<max>`` syntax.
|
||||
This requires only the ``<min>`` version of CMake, but when running a
|
||||
newer version, sets policies up to the ``<max>`` version.
|
@ -1744,7 +1744,7 @@ void cmMakefile::Configure()
|
||||
this->SetCheckCMP0000(true);
|
||||
|
||||
// Implicitly set the version for the user.
|
||||
cmPolicies::ApplyPolicyVersion(this, 2, 4, 0,
|
||||
cmPolicies::ApplyPolicyVersion(this, 2, 8, 0,
|
||||
cmPolicies::WarnCompat::Off);
|
||||
}
|
||||
}
|
||||
|
@ -294,12 +294,24 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
|
||||
unsigned int patchVer,
|
||||
WarnCompat warnCompat)
|
||||
{
|
||||
// Warn about policy versions for which support will be removed.
|
||||
if (warnCompat == WarnCompat::On &&
|
||||
(majorVer < 3 || (majorVer == 3 && minorVer < 10)) &&
|
||||
// Error on policy versions for which support has been removed.
|
||||
if (majorVer < 2 || (majorVer == 2 && minorVer < 8)) {
|
||||
if (IsFromLegacyInstallEXPORT(mf, majorVer, minorVer, patchVer)) {
|
||||
// Silently tolerate cmake_policy calls generated by install(EXPORT)
|
||||
// in CMake versions prior to 3.18.
|
||||
!IsFromLegacyInstallEXPORT(mf, majorVer, minorVer, patchVer)) {
|
||||
majorVer = 2;
|
||||
minorVer = 8;
|
||||
patchVer = 0;
|
||||
} else {
|
||||
mf->IssueMessage(MessageType::FATAL_ERROR,
|
||||
"Compatibility with CMake < 2.8.0 has been removed "
|
||||
"from CMake.\n" ADVICE_UPDATE_VERSION_ARGUMENT);
|
||||
cmSystemTools::SetFatalErrorOccurred();
|
||||
return false;
|
||||
}
|
||||
} else if ((majorVer < 3 || (majorVer == 3 && minorVer < 10)) &&
|
||||
warnCompat == WarnCompat::On) {
|
||||
// Warn about policy versions for which support will be removed.
|
||||
mf->IssueMessage(
|
||||
MessageType::DEPRECATION_WARNING,
|
||||
"Compatibility with CMake < 3.10 will be removed from "
|
||||
|
@ -1,5 +0,0 @@
|
||||
CMake Warning \(dev\) at Before24.cmake:1 \(cmake_minimum_required\):
|
||||
Compatibility with CMake < 2.4 is not supported by CMake >= 3.0.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -1 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.2)
|
@ -8,17 +8,7 @@
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Deprecation Warning at BeforeVersionDeprecated\.cmake:2 \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Deprecation Warning at BeforeVersionDeprecated\.cmake:6 \(cmake_policy\):
|
||||
CMake Deprecation Warning at BeforeVersionDeprecated\.cmake:5 \(cmake_policy\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
cmake_policy(VERSION 2.6)
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call
|
||||
cmake_policy(POP)
|
||||
|
@ -0,0 +1,8 @@
|
||||
^CMake Error at BeforeVersionRemoved\.cmake:1 \(cmake_minimum_required\):
|
||||
Compatibility with CMake < 2\.8\.0 has been removed from CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
@ -0,0 +1 @@
|
||||
cmake_minimum_required(VERSION 2.6.4)
|
@ -1,15 +0,0 @@
|
||||
^CMake Deprecation Warning at CompatBefore24\.cmake:1 \(cmake_minimum_required\):
|
||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||
CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
||||
+
|
||||
CMake Error in CMakeLists.txt:
|
||||
You have set CMAKE_BACKWARDS_COMPATIBILITY to a CMake version less than
|
||||
2.4. This version of CMake only supports backwards compatibility with
|
||||
CMake 2.4 or later. For compatibility with older versions please use any
|
||||
CMake 2.8.x release or lower.
|
@ -1,2 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
set(CMAKE_BACKWARDS_COMPATIBILITY 2.2)
|
@ -1,6 +0,0 @@
|
||||
CMake Error at PolicyBefore24.cmake:2 \(cmake_policy\):
|
||||
Compatibility with CMake < 2.4 is not supported by CMake >= 3.0. For
|
||||
compatibility with older versions please use any CMake 2.8.x release or
|
||||
lower.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:3 \(include\)
|
@ -1,2 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.4)
|
||||
cmake_policy(VERSION 2.2)
|
@ -0,0 +1,8 @@
|
||||
^CMake Error at PolicyBeforeVersionRemoved\.cmake:1 \(cmake_policy\):
|
||||
Compatibility with CMake < 2\.8\.0 has been removed from CMake\.
|
||||
|
||||
Update the VERSION argument <min> value\. Or, use the <min>\.\.\.<max> syntax
|
||||
to tell CMake that the project requires at least <min> but has been updated
|
||||
to work with policies introduced by <max> or earlier\.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists\.txt:[0-9]+ \(include\)$
|
@ -0,0 +1 @@
|
||||
cmake_policy(VERSION 2.6.4)
|
@ -1,9 +1,8 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(Before24)
|
||||
run_cmake(CompatBefore24)
|
||||
run_cmake(BeforeVersionRemoved)
|
||||
run_cmake(PolicyBeforeVersionRemoved)
|
||||
run_cmake(Future)
|
||||
run_cmake(PolicyBefore24)
|
||||
run_cmake(BeforeVersionDeprecated)
|
||||
run_cmake(Range)
|
||||
run_cmake(RangeBad)
|
||||
|
Loading…
Reference in New Issue
Block a user