From 9789594684e983077db9baf56bafa8a8842818a2 Mon Sep 17 00:00:00 2001
From: Tim Kaune <tim.kaune@gmx.de>
Date: Mon, 24 Mar 2025 10:43:10 +0100
Subject: [PATCH] Move choice of CMake generator to user preset file

---
 CMakeLists.txt                 |  2 +-
 CMakePresets.json              | 37 +++++++++++++++++--------------
 CMakeUserPresets.template.json |  2 ++
 README.md                      | 40 ++++++++++++++++++----------------
 4 files changed, 45 insertions(+), 36 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 573c3cd..ec6c98f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ set(CMAKE_MAXIMUM_SUPPORTED_VERSION 3.31)
 
 cmake_minimum_required(VERSION 3.12...${CMAKE_MAXIMUM_SUPPORTED_VERSION})
 
-project(AccelerateLAPACKE VERSION 1.2.0 LANGUAGES C)
+project(AccelerateLAPACKE VERSION 1.3.0 LANGUAGES C)
 
 include(FetchContent)
 
diff --git a/CMakePresets.json b/CMakePresets.json
index cc056b6..4470a11 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -7,13 +7,17 @@
   },
   "configurePresets": [
     {
-      "name": "base",
+      "name": "install",
       "hidden": true,
-      "binaryDir": "${sourceDir}/build",
       "cacheVariables": {
         "CMAKE_INSTALL_PREFIX": "$env{HOME}/.local"
       }
     },
+    {
+      "name": "make",
+      "hidden": true,
+      "generator": "Unix Makefiles"
+    },
     {
       "name": "ninja",
       "hidden": true,
@@ -22,8 +26,7 @@
     {
       "name": "accelerate-lapacke32",
       "inherits": [
-        "base",
-        "ninja"
+        "install"
       ],
       "binaryDir": "${sourceDir}/build/32",
       "cacheVariables": {
@@ -34,8 +37,7 @@
     {
       "name": "accelerate-lapacke64",
       "inherits": [
-        "base",
-        "ninja"
+        "install"
       ],
       "binaryDir": "${sourceDir}/build/64",
       "cacheVariables": {
@@ -50,27 +52,30 @@
       "hidden": true,
       "verbose": true
     },
+    {
+      "name": "install",
+      "hidden": true,
+      "targets": [
+        "install"
+      ]
+    },
     {
       "name": "accelerate-lapacke32",
       "inherits": [
-        "verbose"
+        "verbose",
+        "install"
       ],
       "displayName": "LAPACKE 32bit build linking against Accelerate and installation",
-      "configurePreset": "accelerate-lapacke32",
-      "targets": [
-        "install"
-      ]
+      "configurePreset": "accelerate-lapacke32"
     },
     {
       "name": "accelerate-lapacke64",
       "inherits": [
-        "verbose"
+        "verbose",
+        "install"
       ],
       "displayName": "LAPACKE 64bit build linking against Accelerate ILP64 interface and installation",
-      "configurePreset": "accelerate-lapacke64",
-      "targets": [
-        "install"
-      ]
+      "configurePreset": "accelerate-lapacke64"
     }
   ],
   "workflowPresets": [
diff --git a/CMakeUserPresets.template.json b/CMakeUserPresets.template.json
index 2b67a22..66d30c6 100644
--- a/CMakeUserPresets.template.json
+++ b/CMakeUserPresets.template.json
@@ -7,6 +7,7 @@
     {
       "name": "user-accelerate-lapacke32",
       "inherits": [
+        "ninja",
         "accelerate-lapacke32"
       ],
       "cacheVariables": {
@@ -17,6 +18,7 @@
     {
       "name": "user-accelerate-lapacke64",
       "inherits": [
+        "ninja",
         "accelerate-lapacke64"
       ],
       "cacheVariables": {
diff --git a/README.md b/README.md
index 45b684f..c0e4aa7 100644
--- a/README.md
+++ b/README.md
@@ -26,27 +26,28 @@ SOFTWARE.
 # Accelerate LAPACKE #
 
 Since MacOS 13.3 Ventura, Apple's Accelerate framework comes with a new
-[BLAS/LAPACK
-interface](https://developer.apple.com/documentation/accelerate/blas) compatible
-with [Reference LAPACK
-v3.9.1](https://github.com/Reference-LAPACK/lapack/releases/tag/v3.9.1). It also
-provides an ILP64 interface. On Apple Silicon M-processors, it utilises the
-[proprietary AMX co-processor](https://github.com/corsix/amx), which makes it
-especially interesting. Unfortunately, it comes without the LAPACKE C-interface
-library.
+[BLAS/LAPACK interface][accelerate-docs] compatible with [Reference LAPACK
+v3.9.1][lapack-v3.9.1]. It also provides an ILP64 interface. On Apple Silicon
+M-processors, it utilises the [proprietary AMX co-processor][apple-amx], which
+makes it especially interesting. Unfortunately, it comes without the LAPACKE
+C-interface library.
 
 **Update**: With the release of MacOS 15.0 Sequoia, Apple updated the Accelerate
-framework to be compatible with [Reference LAPACK
-v3.11.0](https://github.com/Reference-LAPACK/lapack/releases/tag/v3.11.0).
+framework to be compatible with [Reference LAPACK v3.11.0][lapack-v3.11.0].
 Unfortunately, there is no mention of it in the [MacOS 15.0 Sequoia Release
-Notes](), but the note in the [Accelerate BLAS
-docs](https://developer.apple.com/documentation/accelerate/blas) has been
-updated accordingly.
+Notes][macos15-release-notes], but the note in the [Accelerate BLAS
+docs][accelerate-docs] has been updated accordingly.
 
 These new interfaces are hidden behind the preprocessor defines
 `ACCELERATE_NEW_LAPACK` and `ACCELERATE_LAPACK_ILP64` and they only work, if you
 include the Accelerate C/C++ headers.
 
+[accelerate-docs]: https://developer.apple.com/documentation/accelerate/blas-library
+[apple-amx]: https://github.com/corsix/amx
+[lapack-v3.9.1]: https://github.com/Reference-LAPACK/lapack/releases/tag/v3.9.1
+[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 ##
 
 But what if you have to or just want to link against the Accelerate framework
@@ -58,12 +59,11 @@ the linker, when linking any program or library that uses the standard
 BLAS/LAPACK API.
 
 Take, for example, the `dgeqrt` LAPACK routine, that is used by the [Reference
-LAPACK CMake
-script](https://github.com/Reference-LAPACK/lapack/blob/v3.9.1/CMakeLists.txt#L315-L316)
-to determine, if the user provided LAPACK version is recent enough. When the
-Fortran test executable is compiled, the `gfortran` compiler creates a function
-call with the binary symbol `_dgeqrt_`, which results in the following error
-when linking to Accelerate (`ld` is the Apple system linker, here):
+LAPACK CMake script][dgeqrt-ref] to determine, if the user provided LAPACK
+version is recent enough. When the Fortran test executable is compiled, the
+`gfortran` compiler creates a function call with the binary symbol `_dgeqrt_`,
+which results in the following error when linking to Accelerate (`ld` is the
+Apple system linker, here):
 
 ```plaintext
 ld: Undefined symbols:
@@ -75,6 +75,8 @@ The reason for this is, that the binary symbol provided by the Accelerate
 framework is called `_dgeqrt$NEWLAPACK`, literally. This is a symbol, that no
 Fortran compiler will probably ever emit voluntarily. So, what to do?
 
+[dgeqrt-ref]: https://github.com/Reference-LAPACK/lapack/blob/v3.11.0/CMakeLists.txt#L365-L366
+
 ## The Solution ##
 
 According to its `man` page, the Apple system linker `ld` provides the options
-- 
GitLab