From af7ca8d6f9fe89ddb2a0deff64c38a0659f73850 Mon Sep 17 00:00:00 2001 From: Florent Pruvost <florent.pruvost@inria.fr> Date: Tue, 20 Aug 2024 15:08:57 +0200 Subject: [PATCH] Find BLAS: replace libblis|libmkl|libopenblas by blis|mkl|openblas to fix case when libraries are directly given by users, and used as it is, with -L and -l options (no absolute path) --- modules/find/FindBLASEXT.cmake | 14 +++++++------- modules/find/FindCBLAS.cmake | 8 ++++---- modules/find/FindLAPACKE.cmake | 4 ++-- modules/find/FindLAPACKEXT.cmake | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/find/FindBLASEXT.cmake b/modules/find/FindBLASEXT.cmake index 1a03cfa..c0c1eef 100644 --- a/modules/find/FindBLASEXT.cmake +++ b/modules/find/FindBLASEXT.cmake @@ -77,7 +77,7 @@ endmacro() if (BLAS_FOUND) - if(BLAS_LIBRARIES MATCHES "libmkl") + if(BLAS_LIBRARIES MATCHES "mkl") if(NOT BLASEXT_FIND_QUIETLY) message(STATUS "FindBLASEXT: BLAS_LIBRARIES matches mkl") endif() @@ -108,23 +108,23 @@ if (BLAS_FOUND) unset(BLAS_LIBRARIES) find_package(BLAS QUIET) - else(BLAS_LIBRARIES MATCHES "libmkl") + else(BLAS_LIBRARIES MATCHES "mkl") blasext_set_library( SEQ ) - endif(BLAS_LIBRARIES MATCHES "libmkl") + endif(BLAS_LIBRARIES MATCHES "mkl") # number of theads function detection - if(BLAS_LIBRARIES MATCHES "libblis|libmkl|libopenblas") + if(BLAS_LIBRARIES MATCHES "blis|mkl|openblas") include(CheckFortranFunctionExists) set(CMAKE_REQUIRED_LIBRARIES "${BLAS_LIBRARIES}") - if(BLAS_LIBRARIES MATCHES "libblis") + if(BLAS_LIBRARIES MATCHES "blis") unset(HAVE_BLI_THREAD_SET_NUM_THREADS CACHE) check_fortran_function_exists(bli_thread_set_num_threads HAVE_BLI_THREAD_SET_NUM_THREADS) - elseif(BLAS_LIBRARIES MATCHES "libmkl") + elseif(BLAS_LIBRARIES MATCHES "mkl") unset(HAVE_MKL_SET_NUM_THREADS CACHE) check_fortran_function_exists(mkl_set_num_threads HAVE_MKL_SET_NUM_THREADS) - elseif(BLAS_LIBRARIES MATCHES "libopenblas") + elseif(BLAS_LIBRARIES MATCHES "openblas") unset(HAVE_OPENBLAS_SET_NUM_THREADS CACHE) check_fortran_function_exists(openblas_set_num_threads HAVE_OPENBLAS_SET_NUM_THREADS) endif() diff --git a/modules/find/FindCBLAS.cmake b/modules/find/FindCBLAS.cmake index afede06..d4ba9d2 100644 --- a/modules/find/FindCBLAS.cmake +++ b/modules/find/FindCBLAS.cmake @@ -171,11 +171,11 @@ macro(cblas_check_include) # Try to find the cblas header in the given paths # ------------------------------------------------- - if (CBLAS_LIBRARIES MATCHES "libblis") + if (CBLAS_LIBRARIES MATCHES "blis") set(CBLAS_hdrs_to_find "blis.h;cblas.h") - elseif(CBLAS_LIBRARIES MATCHES "libmkl") + elseif(CBLAS_LIBRARIES MATCHES "mkl") set(CBLAS_hdrs_to_find "mkl.h;mkl_cblas.h;mkl_service.h") - elseif(CBLAS_LIBRARIES MATCHES "libopenblas") + elseif(CBLAS_LIBRARIES MATCHES "openblas") set(CBLAS_hdrs_to_find "cblas.h;openblas_config.h") else() set(CBLAS_hdrs_to_find "cblas.h") @@ -226,7 +226,7 @@ if (CBLAS_BLAS) # Set the mkl library dirs for compatibility with former version # -------------------------------------------------------------- - if (CBLAS_LIBRARIES MATCHES "libmkl" AND DEFINED ENV{MKLROOT}) + if (CBLAS_LIBRARIES MATCHES "mkl" AND DEFINED ENV{MKLROOT}) set(CBLAS_PREFIX "$ENV{MKLROOT}" CACHE PATH "Installation directory of CBLAS library" FORCE) set(CBLAS_LIBRARY_DIRS "${CBLAS_PREFIX}/lib/intel64") endif() diff --git a/modules/find/FindLAPACKE.cmake b/modules/find/FindLAPACKE.cmake index 9e7320a..c1ce371 100644 --- a/modules/find/FindLAPACKE.cmake +++ b/modules/find/FindLAPACKE.cmake @@ -178,7 +178,7 @@ macro(lapacke_check_include) # Try to find the lapacke header in the given paths # ------------------------------------------------- - if (LAPACKE_LIBRARIES MATCHES "libmkl") + if (LAPACKE_LIBRARIES MATCHES "mkl") set(LAPACKE_hdrs_to_find "mkl.h") else() set(LAPACKE_hdrs_to_find "lapacke.h") @@ -261,7 +261,7 @@ if (LAPACKE_LAPACK) # Set the mkl library dirs for compatibility with former version # -------------------------------------------------------------- - if (LAPACKE_LIBRARIES MATCHES "libmkl" AND DEFINED ENV{MKLROOT}) + if (LAPACKE_LIBRARIES MATCHES "mkl" AND DEFINED ENV{MKLROOT}) set(LAPACKE_PREFIX "$ENV{MKLROOT}" CACHE PATH "Installation directory of LAPACKE library" FORCE) set(LAPACKE_LIBRARY_DIRS "${LAPACKE_PREFIX}/lib/intel64") endif() diff --git a/modules/find/FindLAPACKEXT.cmake b/modules/find/FindLAPACKEXT.cmake index 1ed4308..bb33d82 100644 --- a/modules/find/FindLAPACKEXT.cmake +++ b/modules/find/FindLAPACKEXT.cmake @@ -77,7 +77,7 @@ endmacro() if (LAPACK_FOUND) - if(LAPACK_LIBRARIES MATCHES "libmkl") + if(LAPACK_LIBRARIES MATCHES "mkl") if(NOT LAPACKEXT_FIND_QUIETLY) message(STATUS "FindLAPACKEXT: LAPACK_LIBRARIES matches mkl") endif() @@ -111,11 +111,11 @@ if (LAPACK_FOUND) unset(LAPACK_LIBRARIES) find_package(LAPACK QUIET) - else(LAPACK_LIBRARIES MATCHES "libmkl") + else(LAPACK_LIBRARIES MATCHES "mkl") lapackext_set_library( SEQ ) - endif(LAPACK_LIBRARIES MATCHES "libmkl") + endif(LAPACK_LIBRARIES MATCHES "mkl") else(LAPACK_FOUND) if(NOT LAPACKEXT_FIND_QUIETLY) -- GitLab