From c148f44f59801485e25314fca14ed4c0c9f6f223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Skrzy=C5=84ski?= Date: Tue, 17 Oct 2023 18:21:15 +0200 Subject: [PATCH] search for Eigen package when EIGEN_INCLUDE_DIR is not provided --- cmake/options.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/options.cmake b/cmake/options.cmake index 367a62721..9c0251d14 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -25,15 +25,22 @@ option(PRESSIO_ENABLE_TPL_PYBIND11 "Enable Pybind11 TPL" OFF) if(PRESSIO_ENABLE_TPL_EIGEN) message(">> Eigen is currently enabled by default via PRESSIO_ENABLE_TPL_EIGEN=ON") - if(NOT EIGEN_INCLUDE_DIR) - # FIXME: use FetchContent_Declare instead of failing? - message(FATAL_ERROR + add_definitions(-DPRESSIO_ENABLE_TPL_EIGEN) + + if(EIGEN_INCLUDE_DIR) + include_directories(${EIGEN_INCLUDE_DIR}) + else() + find_package(Eigen3) + + if(NOT EIGEN3_FOUND) + # FIXME: use FetchContent_Declare instead of failing? + message(FATAL_ERROR "I cannot find the Eigen headers. " "Please reconfigure with: -DEIGEN_INCLUDE_DIR=") - endif() + endif() - include_directories(${EIGEN_INCLUDE_DIR}) - add_definitions(-DPRESSIO_ENABLE_TPL_EIGEN) + include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR}) + endif() endif() # if trilinos is on, then also set MPI, BLAS, LAPACK and KOKKOS ON