From 0cb6920803d515439b637a4f418b6c7d16c7e7b6 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 20 Nov 2024 20:38:42 +0800 Subject: [PATCH] cmake: Only add -DACCELERATE_NEW_LAPACK definition if linking the macOS Accelerate Framework (#8626) --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 908f7636471..bed84161fb0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -230,11 +230,11 @@ else (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") set (ACCELERATE_NEW_LAPACK 0) endif (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") -if (HAVE_LAPACK AND ACCELERATE_NEW_LAPACK GREATER 0) +if (HAVE_LAPACK AND ACCELERATE_NEW_LAPACK GREATER 0 AND LAPACK_LIBRARIES MATCHES ".*Accelerate.*") # Recent macOS with Darwin kernel > 22.4 needs this compiler flag: add_compile_definitions(ACCELERATE_NEW_LAPACK) message("-- Must add compiler flag -DACCELERATE_NEW_LAPACK definition for macOS kernel version ${CMAKE_HOST_SYSTEM_VERSION}") -endif (HAVE_LAPACK AND ACCELERATE_NEW_LAPACK GREATER 0) +endif (HAVE_LAPACK AND ACCELERATE_NEW_LAPACK GREATER 0 AND LAPACK_LIBRARIES MATCHES ".*Accelerate.*") if (NOT DEFINED GMT_EXCLUDE_BLAS) find_package (BLAS)