cmake - also use find_package to find Eigen3

This commit is contained in:
Andrej730
2025-08-18 12:12:29 +05:00
parent 53e9837858
commit bd8cdf5a82
+10 -2
View File
@@ -795,8 +795,16 @@ endif(MSVC)
# Ensure other dependencies are provided.
if(NOT EIGEN_DIR OR NOT EXISTS "${EIGEN_DIR}")
message(FATAL_ERROR "EIGEN_DIR is not provided or provided folder doesn't exist (current value: '${EIGEN_DIR}').")
if(NOT EXISTS "${EIGEN_DIR}")
find_package(Eigen3 CONFIG)
if(NOT Eigen3_DIR)
message(
FATAL_ERROR
"EIGEN_DIR is not provided or provided folder doesn't exist (current value: '${EIGEN_DIR}'). "
"Also couldn't find Eigen3 as a package."
)
endif()
link_libraries(Eigen3::Eigen)
endif()