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 <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10925
This commit is contained in:
Brad King
2025-07-03 17:02:53 +00:00
committed by Kitware Robot
8 changed files with 16 additions and 8 deletions

View File

@@ -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)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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 */
}

View File

@@ -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.

View File

@@ -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\.$

View File

@@ -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)

View File

@@ -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)