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.
This commit is contained in:
Brad King
2026-06-05 11:15:31 -04:00
parent 54dd3c08db
commit 3dca3b048d
2 changed files with 3 additions and 3 deletions

View File

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

View File

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