From 3dca3b048d5deb5ca1a5523f6c261db6aef58785 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 5 Jun 2026 11:15:31 -0400 Subject: [PATCH] export: Increase maximum policy version in exported files to 4.3 The files generated by `install(EXPORT)`, `export()`, and `install_jar_exports()` commands are known to work with policies as of CMake 4.3, so enable them in sufficiently new CMake versions. --- Modules/UseJava/javaTargets.cmake.in | 2 +- Source/cmExportCMakeConfigGenerator.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/UseJava/javaTargets.cmake.in b/Modules/UseJava/javaTargets.cmake.in index 157a60e200..b7e610743b 100644 --- a/Modules/UseJava/javaTargets.cmake.in +++ b/Modules/UseJava/javaTargets.cmake.in @@ -1,5 +1,5 @@ cmake_policy(PUSH) -cmake_policy(VERSION 2.8.12...4.2) +cmake_policy(VERSION 2.8.12...4.3) #---------------------------------------------------------------- # Generated CMake Java target import file. diff --git a/Source/cmExportCMakeConfigGenerator.cxx b/Source/cmExportCMakeConfigGenerator.cxx index 353d38f9eb..ef80d1ccfa 100644 --- a/Source/cmExportCMakeConfigGenerator.cxx +++ b/Source/cmExportCMakeConfigGenerator.cxx @@ -176,7 +176,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 4.2 (this upper limit may be reviewed + // policy settings for up to CMake 4.3 (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. @@ -185,7 +185,7 @@ void cmExportCMakeConfigGenerator::GeneratePolicyHeaderCode(std::ostream& os) "cmake_policy(VERSION " << this->RequiredCMakeVersionMajor << '.' << this->RequiredCMakeVersionMinor << '.' - << this->RequiredCMakeVersionPatch << "...4.2)\n"; + << this->RequiredCMakeVersionPatch << "...4.3)\n"; /* clang-format on */ }