Browse Source

Merge topic 'post-rel-dev'

8071304f2e Configure CMake itself with policies through CMake 4.0
f7380d8c4a export: Increase maximum policy version in exported files to 4.0
94ff184a63 Add deprecation warnings for policies CMP0143 and below

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !10925
Brad King 6 months ago
parent
commit
bc07a21836

+ 1 - 1
CMakeLists.txt

@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file LICENSE.rst or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.13...3.31 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...4.0 FATAL_ERROR)
 set(CMAKE_USER_MAKE_RULES_OVERRIDE_C ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideC.cmake)
 set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/Source/Modules/OverrideCXX.cmake)
 

+ 1 - 1
Modules/UseJava/javaTargets.cmake.in

@@ -1,5 +1,5 @@
 cmake_policy(PUSH)
-cmake_policy(VERSION 2.8.12...3.31)
+cmake_policy(VERSION 2.8.12...4.0)
 
 #----------------------------------------------------------------
 # Generated CMake Java target import file.

+ 1 - 1
Source/Checks/Curses/CMakeLists.txt

@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13...3.31 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.13...4.0 FATAL_ERROR)
 project(CheckCurses C)
 
 set(CURSES_NEED_NCURSES TRUE)

+ 2 - 2
Source/cmExportCMakeConfigGenerator.cxx

@@ -173,7 +173,7 @@ void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os)
   // Isolate the file policy level.
   // Support CMake versions as far back as the
   // RequiredCMakeVersion{Major,Minor,Patch}, but also support using NEW
-  // policy settings for up to CMake 3.31 (this upper limit may be reviewed
+  // policy settings for up to CMake 4.0 (this upper limit may be reviewed
   // and increased from time to time). This reduces the opportunity for CMake
   // warnings when an older export file is later used with newer CMake
   // versions.
@@ -182,7 +182,7 @@ void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os)
         "cmake_policy(VERSION "
      << this->RequiredCMakeVersionMajor << '.'
      << this->RequiredCMakeVersionMinor << '.'
-     << this->RequiredCMakeVersionPatch << "...3.31)\n";
+     << this->RequiredCMakeVersionPatch << "...4.0)\n";
   /* clang-format on */
 }
 

+ 1 - 1
Source/cmMakefile.cxx

@@ -4077,7 +4077,7 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
   }
 
   // Deprecate old policies.
-  if (status == cmPolicies::OLD && id <= cmPolicies::CMP0142 &&
+  if (status == cmPolicies::OLD && id <= cmPolicies::CMP0143 &&
       !(this->GetCMakeInstance()->GetIsInTryCompile() &&
         (
           // Policies set by cmCoreTryCompile::TryCompileCode.

+ 8 - 0
Tests/RunCMake/VSSolution/CMP0143-OLD-stderr.txt

@@ -0,0 +1,8 @@
+^CMake Deprecation Warning at CMakeLists\.txt:[0-9]+ \(cmake_minimum_required\):
+  The OLD behavior for policy CMP0143 will be removed from a future version
+  of CMake\.
+
+  The cmake-policies\(7\) manual explains that the OLD behaviors of all
+  policies are deprecated and that a policy should be set to OLD only under
+  specific short-term circumstances\.  Projects should be ported to the NEW
+  behavior and not rely on setting a policy to OLD\.$

+ 1 - 1
Utilities/Doxygen/CMakeLists.txt

@@ -3,7 +3,7 @@
 
 if(NOT CMake_SOURCE_DIR)
   set(CMakeDeveloperReference_STANDALONE 1)
-  cmake_minimum_required(VERSION 3.13...3.31 FATAL_ERROR)
+  cmake_minimum_required(VERSION 3.13...4.0 FATAL_ERROR)
   get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
   get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
   include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)

+ 1 - 1
Utilities/Sphinx/CMakeLists.txt

@@ -3,7 +3,7 @@
 
 if(NOT CMake_SOURCE_DIR)
   set(CMakeHelp_STANDALONE 1)
-  cmake_minimum_required(VERSION 3.13...3.31 FATAL_ERROR)
+  cmake_minimum_required(VERSION 3.13...4.0 FATAL_ERROR)
   get_filename_component(tmp "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
   get_filename_component(CMake_SOURCE_DIR "${tmp}" PATH)
   include(${CMake_SOURCE_DIR}/Modules/CTestUseLaunchers.cmake)