From daeb62da0a7b991792a4d1b13f27129d43219917 Mon Sep 17 00:00:00 2001
From: Tim Kaune <tim.kaune@gmx.de>
Date: Thu, 8 May 2025 14:17:09 +0200
Subject: [PATCH] Add CMake v4 compatibility

---
 CMakePresets.json | 10 ++++++++++
 README.md         | 16 ++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/CMakePresets.json b/CMakePresets.json
index 4470a11..b583b60 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -13,6 +13,16 @@
         "CMAKE_INSTALL_PREFIX": "$env{HOME}/.local"
       }
     },
+    {
+      "name": "cmake4",
+      "hidden": true,
+      "cacheVariables": {
+        "CMAKE_OSX_SYSROOT": "macosx"
+      },
+      "environment": {
+        "CMAKE_POLICY_VERSION_MINIMUM": "3.5"
+      }
+    },
     {
       "name": "make",
       "hidden": true,
diff --git a/README.md b/README.md
index c0e4aa7..a718c7d 100644
--- a/README.md
+++ b/README.md
@@ -48,6 +48,15 @@ include the Accelerate C/C++ headers.
 [lapack-v3.11.0]: https://github.com/Reference-LAPACK/lapack/releases/tag/v3.11.0
 [macos15-release-notes]: https://developer.apple.com/documentation/macos-release-notes/macos-15-release-notes
 
+- [The Problem](#the-problem)
+- [The Solution](#the-solution)
+  - [The alias files (to use in other projects)](#the-alias-files-to-use-in-other-projects)
+- [How to compile](#how-to-compile)
+  - [Prerequisites](#prerequisites)
+  - [Workflow with CMake](#workflow-with-cmake)
+    - [CMake v4 compatibility](#cmake-v4-compatibility)
+  - [Using LAPACKE in another project](#using-lapacke-in-another-project)
+
 ## The Problem ##
 
 But what if you have to or just want to link against the Accelerate framework
@@ -167,6 +176,13 @@ $ cmake --workflow --preset user-accelerate-lapacke32
 I wouldn't recommend installing to `/usr/local` (used by Homebrew on Intel Macs)
 or `/opt/local` (used by MacPorts).
 
+#### CMake v4 compatibility ####
+
+To build the project with CMake v4 or higher, there is a `cmake4` preset, that
+you can use in your `CMakeUserPresets.json`. Both `user-accelerate-lapacke32`
+and `user-accelerate-lapacke64` should additionally inherit from `cmake4`. This
+is not included by default.
+
 ### Using LAPACKE in another project ###
 
 You can use your self-compiled LAPACKE library in other projects by importing
-- 
GitLab