mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-20 04:24:36 +08:00
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:
@@ -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
|
.. versionchanged:: 3.31
|
||||||
|
|
||||||
Compatibility with versions of CMake older than 3.10 is deprecated.
|
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);
|
this->SetCheckCMP0000(true);
|
||||||
|
|
||||||
// Implicitly set the version for the user.
|
// Implicitly set the version for the user.
|
||||||
cmPolicies::ApplyPolicyVersion(this, 2, 4, 0,
|
cmPolicies::ApplyPolicyVersion(this, 2, 8, 0,
|
||||||
cmPolicies::WarnCompat::Off);
|
cmPolicies::WarnCompat::Off);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -294,12 +294,24 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile* mf, unsigned int majorVer,
|
|||||||
unsigned int patchVer,
|
unsigned int patchVer,
|
||||||
WarnCompat warnCompat)
|
WarnCompat warnCompat)
|
||||||
{
|
{
|
||||||
// Warn about policy versions for which support will be removed.
|
// Error on policy versions for which support has been removed.
|
||||||
if (warnCompat == WarnCompat::On &&
|
if (majorVer < 2 || (majorVer == 2 && minorVer < 8)) {
|
||||||
(majorVer < 3 || (majorVer == 3 && minorVer < 10)) &&
|
if (IsFromLegacyInstallEXPORT(mf, majorVer, minorVer, patchVer)) {
|
||||||
// Silently tolerate cmake_policy calls generated by install(EXPORT)
|
// Silently tolerate cmake_policy calls generated by install(EXPORT)
|
||||||
// in CMake versions prior to 3.18.
|
// 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(
|
mf->IssueMessage(
|
||||||
MessageType::DEPRECATION_WARNING,
|
MessageType::DEPRECATION_WARNING,
|
||||||
"Compatibility with CMake < 3.10 will be removed from "
|
"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\):
|
Call Stack \(most recent call first\):
|
||||||
CMakeLists.txt:3 \(include\)
|
CMakeLists.txt:3 \(include\)
|
||||||
+
|
+
|
||||||
CMake Deprecation Warning at BeforeVersionDeprecated\.cmake:2 \(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\.
|
|
||||||
|
|
||||||
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\):
|
|
||||||
Compatibility with CMake < 3\.10 will be removed from a future version of
|
Compatibility with CMake < 3\.10 will be removed from a future version of
|
||||||
CMake\.
|
CMake\.
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.9)
|
cmake_minimum_required(VERSION 3.9)
|
||||||
cmake_policy(VERSION 2.6)
|
|
||||||
cmake_policy(PUSH)
|
cmake_policy(PUSH)
|
||||||
cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call
|
cmake_policy(VERSION 2.6) # simulate pre-3.18 install(EXPORT)-generated call
|
||||||
cmake_policy(POP)
|
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)
|
include(RunCMake)
|
||||||
|
|
||||||
run_cmake(Before24)
|
run_cmake(BeforeVersionRemoved)
|
||||||
run_cmake(CompatBefore24)
|
run_cmake(PolicyBeforeVersionRemoved)
|
||||||
run_cmake(Future)
|
run_cmake(Future)
|
||||||
run_cmake(PolicyBefore24)
|
|
||||||
run_cmake(BeforeVersionDeprecated)
|
run_cmake(BeforeVersionDeprecated)
|
||||||
run_cmake(Range)
|
run_cmake(Range)
|
||||||
run_cmake(RangeBad)
|
run_cmake(RangeBad)
|
||||||
|
Reference in New Issue
Block a user