FindLAPACK: Use find_package_handle_standard_args
FindLAPACK uses custom and verbose output messages. With this update:
- The LAPACK library location is now printed on success,
- Subsequent runs no longer write the message "A library with LAPACK API found.",
- Failure messages use the standardized format, and
- Temporary variables are cleaned before leaving find_package.
Diff for first run of CMake, subsequent run of CMake, and a separate CMake run with LAPACK not found (see test repository:
diff --git a/first.txt b/first.txt
index ca55a60..7e4e516 100644
--- a/first.txt
+++ b/first.txt
@@ -16,7 +16,7 @@
-- Found BLAS: /usr/local/spack/opt/spack/apple-clang/openblas/gkdwhwe/lib/libopenblas.dylib
-- Looking for cheev_
-- Looking for cheev_ - found
--- A library with LAPACK API found.
+-- Found LAPACK: /usr/local/spack/opt/spack/apple-clang/openblas/gkdwhwe/lib/libopenblas.dylib;-lm;-ldl
-- Configuring done
-- Generating done
-- Build files have been written to: /rnsdhpc/code/findlapack-test/build
diff --git a/second.txt b/second.txt
index bf84ee3..dffe0a1 100644
--- a/second.txt
+++ b/second.txt
@@ -1,4 +1,3 @@
--- A library with LAPACK API found.
-- Configuring done
-- Generating done
-- Build files have been written to: /rnsdhpc/code/findlapack-test/build
diff --git a/failure.txt b/failure.txt
index 95f5a86..a7d89a6 100644
--- a/failure.txt
+++ b/failure.txt
@@ -5,8 +5,9 @@
-- Detecting C compile features
-- Detecting C compile features - done
-- Could NOT find BLAS (missing: BLAS_LIBRARIES)
--- LAPACK requires BLAS
--- A library with LAPACK API not found. Please specify library location.
+-- Could NOT find LAPACK (missing: LAPACK_LIBRARIES)
+ Reason given by package: LAPACK could not be found because dependency BLAS could not be found.
+
-- Configuring done
-- Generating done
-- Build files have been written to: /rnsdhpc/code/findlapack-test/build
Edited by Seth R Johnson