summaryrefslogtreecommitdiffstats
path: root/Source/cmExportFileGenerator.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2020-05-16 01:02:42 (GMT)
committerCraig Scott <craig.scott@crascit.com>2020-05-18 22:36:57 (GMT)
commitca24b70d316be44d6503ada6a8c24aa909d78caa (patch)
tree753fc72844b0eee8521b721e6a72ea95fa29848b /Source/cmExportFileGenerator.cxx
parentec1b3992dbfb54edb777988766440295f1f1f1d3 (diff)
downloadCMake-ca24b70d316be44d6503ada6a8c24aa909d78caa.zip
CMake-ca24b70d316be44d6503ada6a8c24aa909d78caa.tar.gz
CMake-ca24b70d316be44d6503ada6a8c24aa909d78caa.tar.bz2
Export: Specify a policy range in exported files
This should reduce policy-related warnings coming from the generated files, but in a way that doesn't increase the minimum CMake version for consumers. Relates: #20561
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r--Source/cmExportFileGenerator.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 28037c6..ed0689a 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -923,12 +923,14 @@ void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os)
/* clang-format on */
// Isolate the file policy level.
- // We use 2.6 here instead of the current version because newer
- // versions of CMake should be able to export files imported by 2.6
- // until the import format changes.
+ // Support CMake versions as far back as 2.6 but also support using NEW
+ // policy settings for up to CMake 3.17 (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.
/* clang-format off */
os << "cmake_policy(PUSH)\n"
- << "cmake_policy(VERSION 2.6)\n";
+ << "cmake_policy(VERSION 2.6...3.17)\n";
/* clang-format on */
}