Skip to content

Commit 968e72d

Browse files
committed
Improve eigen.cmake laplacke support
1 parent e792543 commit 968e72d

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

cmake/recipes/eigen.cmake

+19-7
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,26 @@ if(EIGEN_WITH_MKL)
4545
EIGEN_USE_LAPACKE_STRICT
4646
)
4747
elseif(APPLE)
48-
target_link_libraries(Eigen3_Eigen INTERFACE
49-
"-framework Accelerate"
50-
"/opt/homebrew/opt/lapack/lib/liblapacke.dylib"
51-
)
52-
target_compile_definitions(Eigen3_Eigen INTERFACE
53-
EIGEN_USE_BLAS
54-
EIGEN_USE_LAPACKE_STRICT
48+
find_package(BLAS REQUIRED)
49+
find_library(LAPACKE lapacke PATHS
50+
"/opt/local/lib/lapack"
51+
"/opt/homebrew/opt/lapack/lib"
5552
)
53+
if (NOT LAPACKE)
54+
# BLAS should be available on macOS, but LAPACKE might not be
55+
message(WARNING "LAPACKE library not found (required for EIGEN_USE_LAPACKE on macOS)! "
56+
"Perhaps you need to install it (e.g., brew install lapack). "
57+
"Eigen will be built without LAPACKE support.")
58+
else()
59+
message(STATUS "Found BLAS and LAPACKE. Enabling Eigen LAPACKE support.")
60+
target_link_libraries(Eigen3_Eigen INTERFACE
61+
${BLAS_LIBRARIES} ${LAPACKE}
62+
)
63+
target_compile_definitions(Eigen3_Eigen INTERFACE
64+
EIGEN_USE_BLAS
65+
EIGEN_USE_LAPACKE_STRICT
66+
)
67+
endif()
5668
endif()
5769

5870
# On Windows, enable natvis files to improve debugging experience

0 commit comments

Comments
 (0)