From 4b462d0b12d7eed062760aff01911648e9482331 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Wed, 16 Aug 2023 17:44:52 +1000 Subject: [PATCH] Accept NEW CMake policies up to CMake 3.14 Starting with CMake 3.27, deprecation warnings are issued when asking for policy settings for CMake 3.4 or earlier. The cmake_minimum_required() command accepts a version range, which allows NEW policy settings up to the upper end of that range to be used, but without raising the minimum CMake version above the bottom of that range. This means NEW policy settings will be used where available, without requiring them. This change updates the project's cmake_minimum_required() calls to use a version range to extend the upper policy version to 3.14 where it wasn't already at that version or higher. This prevents the deprecation warning from CMake 3.27, and gives breathing space before a future CMake release will start issuing similar deprecation warnings again. --- CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- tests/benchmarks/CMakeLists.txt | 2 +- tests/cmake_add_subdirectory/project/CMakeLists.txt | 2 +- tests/cmake_fetch_content/project/CMakeLists.txt | 2 +- tests/cmake_import/project/CMakeLists.txt | 2 +- tests/cmake_import_minver/project/CMakeLists.txt | 2 +- tests/cmake_target_include_directories/project/CMakeLists.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f942e04ab12..38d45b729ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.14) ## ## PROJECT diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3b9ae4d91e6..a153a69248c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.13...3.14) option(JSON_Valgrind "Execute test suite with Valgrind." OFF) option(JSON_FastTests "Skip expensive/slow tests." OFF) diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt index 92ff0ea7b8e..4aa095e3919 100644 --- a/tests/benchmarks/CMakeLists.txt +++ b/tests/benchmarks/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.11...3.14) project(JSON_Benchmarks LANGUAGES CXX) # set compiler flags diff --git a/tests/cmake_add_subdirectory/project/CMakeLists.txt b/tests/cmake_add_subdirectory/project/CMakeLists.txt index caab6c4e16e..0695305ff91 100644 --- a/tests/cmake_add_subdirectory/project/CMakeLists.txt +++ b/tests/cmake_add_subdirectory/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.14) project(DummyImport CXX) diff --git a/tests/cmake_fetch_content/project/CMakeLists.txt b/tests/cmake_fetch_content/project/CMakeLists.txt index fd8fbdd5f3e..b64af9ea5c5 100644 --- a/tests/cmake_fetch_content/project/CMakeLists.txt +++ b/tests/cmake_fetch_content/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.11) +cmake_minimum_required(VERSION 3.11...3.14) project(DummyImport CXX) diff --git a/tests/cmake_import/project/CMakeLists.txt b/tests/cmake_import/project/CMakeLists.txt index fe892fc1f67..585f34cef3b 100644 --- a/tests/cmake_import/project/CMakeLists.txt +++ b/tests/cmake_import/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.14) project(DummyImport CXX) diff --git a/tests/cmake_import_minver/project/CMakeLists.txt b/tests/cmake_import_minver/project/CMakeLists.txt index 29056bdc546..25e40bfac20 100644 --- a/tests/cmake_import_minver/project/CMakeLists.txt +++ b/tests/cmake_import_minver/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.14) project(DummyImportMinVer CXX) diff --git a/tests/cmake_target_include_directories/project/CMakeLists.txt b/tests/cmake_target_include_directories/project/CMakeLists.txt index f56786c091b..26b55cd891d 100644 --- a/tests/cmake_target_include_directories/project/CMakeLists.txt +++ b/tests/cmake_target_include_directories/project/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.1...3.14) project(DummyImport CXX)