From fbe1763675cfe0f21c20aa95b658dc94bde6b8ac Mon Sep 17 00:00:00 2001
From: Philip Top <phlptp@gmail.com>
Date: Mon, 2 Jan 2023 06:33:44 -0800
Subject: [PATCH] add new CMAKE version support and fix CI test failure (#823)

---
 .github/workflows/tests.yml | 18 +++++++++++++++---
 CMakeLists.txt              |  4 ++--
 tests/CMakeLists.txt        |  2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index cfc7938d9..e421012cf 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -236,16 +236,28 @@ jobs:
           cmake-version: "3.20"
         if: success() || failure()
 
-      - name: Check CMake 3.21 (full)
+      - name: Check CMake 3.21
         uses: ./.github/actions/quick_cmake
         with:
           cmake-version: "3.21"
-          args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
         if: success() || failure()
 
-      - name: Check CMake 3.22 (full)
+      - name: Check CMake 3.22
         uses: ./.github/actions/quick_cmake
         with:
           cmake-version: "3.22"
+        if: success() || failure()
+
+      - name: Check CMake 3.23 (full)
+        uses: ./.github/actions/quick_cmake
+        with:
+          cmake-version: "3.23"
+          args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
+        if: success() || failure()
+
+      - name: Check CMake 3.24 (full)
+        uses: ./.github/actions/quick_cmake
+        with:
+          cmake-version: "3.24"
           args: -DCLI11_SANITIZERS=ON -DCLI11_BUILD_EXAMPLES_JSON=ON
         if: success() || failure()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31bbbbb6c..bad2b004e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,10 +6,10 @@ cmake_minimum_required(VERSION 3.4)
 # of CMake. For most of the policies, the new version is better (hence the change).
 # We don't use the 3.4...3.21 syntax because of a bug in an older MSVC's
 # built-in and modified CMake 3.11
-if(${CMAKE_VERSION} VERSION_LESS 3.22)
+if(${CMAKE_VERSION} VERSION_LESS 3.24)
   cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
 else()
-  cmake_policy(VERSION 3.22)
+  cmake_policy(VERSION 3.24)
 endif()
 
 set(VERSION_REGEX "#define CLI11_VERSION[ \t]+\"(.+)\"")
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7d89e128b..360d57a8f 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -4,7 +4,7 @@ if(CLI11_SANITIZERS)
     sanitizers
     GIT_REPOSITORY https://github.com/arsenm/sanitizers-cmake.git
     GIT_SHALLOW 1
-    GIT_TAG 99e159e)
+    GIT_TAG a6748f4)
 
   FetchContent_GetProperties(sanitizers)