From 7dd3cfe5662cdebba0f99a35652aa1b9cc336f74 Mon Sep 17 00:00:00 2001 From: Florent Pruvost <florent.pruvost@inria.fr> Date: Mon, 9 Apr 2018 12:05:24 +0200 Subject: [PATCH] LIBRARY_DIRS may be found with pkg-config now --- modules/find/FindBLASEXT.cmake | 39 ++++++++++++++++---------------- modules/find/FindLAPACKEXT.cmake | 39 ++++++++++++++++---------------- 2 files changed, 40 insertions(+), 38 deletions(-) diff --git a/modules/find/FindBLASEXT.cmake b/modules/find/FindBLASEXT.cmake index a12a199..0fff826 100644 --- a/modules/find/FindBLASEXT.cmake +++ b/modules/find/FindBLASEXT.cmake @@ -305,29 +305,30 @@ if(BLAS_SEQ_LIBRARIES) set(BLAS_LINKER_FLAGS "${BLAS_SEQ_LINKER_FLAGS}") endif() -# extract libs paths -# remark: because it is not given by find_package(BLAS) -set(BLAS_LIBRARY_DIRS "") -string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}") -foreach(blas_lib ${BLAS_LIBRARIES}) - if (EXISTS "${blas_lib}") - get_filename_component(a_blas_lib_dir "${blas_lib}" PATH) - list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" ) - else() - string(REPLACE "-L" "" blas_lib "${blas_lib}") +# extract libs paths if not given by find_package(BLAS) +if (NOT BLAS_LIBRARY_DIRS) + set(BLAS_LIBRARY_DIRS "") + string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}") + foreach(blas_lib ${BLAS_LIBRARIES}) if (EXISTS "${blas_lib}") - list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" ) - else() get_filename_component(a_blas_lib_dir "${blas_lib}" PATH) - if (EXISTS "${a_blas_lib_dir}") - list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" ) + list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" ) + else() + string(REPLACE "-L" "" blas_lib "${blas_lib}") + if (EXISTS "${blas_lib}") + list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" ) + else() + get_filename_component(a_blas_lib_dir "${blas_lib}" PATH) + if (EXISTS "${a_blas_lib_dir}") + list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" ) + endif() endif() endif() - endif() -endforeach() -if (BLAS_LIBRARY_DIRS) - list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS) -endif () + endforeach() + if (BLAS_LIBRARY_DIRS) + list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS) + endif () +endif(NOT BLAS_LIBRARY_DIRS) # check that BLASEXT has been found # --------------------------------- diff --git a/modules/find/FindLAPACKEXT.cmake b/modules/find/FindLAPACKEXT.cmake index 7cce670..52ebd11 100644 --- a/modules/find/FindLAPACKEXT.cmake +++ b/modules/find/FindLAPACKEXT.cmake @@ -245,29 +245,30 @@ if (LAPACK_SEQ_LIBRARIES) set(LAPACK_LIBRARIES "${LAPACK_SEQ_LIBRARIES}") endif() -# extract libs paths -# remark: because it is not given by find_package(LAPACK) -set(LAPACK_LIBRARY_DIRS "") -string(REPLACE " " ";" LAPACK_LIBRARIES "${LAPACK_LIBRARIES}") -foreach(lapack_lib ${LAPACK_LIBRARIES}) - if (EXISTS "${lapack_lib}") - get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH) - list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" ) - else() - string(REPLACE "-L" "" lapack_lib "${lapack_lib}") +# extract libs paths if not given by find_package(LAPACK) +if (NOT LAPACK_LIBRARY_DIRS) + set(LAPACK_LIBRARY_DIRS "") + string(REPLACE " " ";" LAPACK_LIBRARIES "${LAPACK_LIBRARIES}") + foreach(lapack_lib ${LAPACK_LIBRARIES}) if (EXISTS "${lapack_lib}") - list(APPEND LAPACK_LIBRARY_DIRS "${lapack_lib}" ) - else() get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH) - if (EXISTS "${a_lapack_lib_dir}") - list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" ) + list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" ) + else() + string(REPLACE "-L" "" lapack_lib "${lapack_lib}") + if (EXISTS "${lapack_lib}") + list(APPEND LAPACK_LIBRARY_DIRS "${lapack_lib}" ) + else() + get_filename_component(a_lapack_lib_dir "${lapack_lib}" PATH) + if (EXISTS "${a_lapack_lib_dir}") + list(APPEND LAPACK_LIBRARY_DIRS "${a_lapack_lib_dir}" ) + endif() endif() endif() - endif() -endforeach() -if (LAPACK_LIBRARY_DIRS) - list(REMOVE_DUPLICATES LAPACK_LIBRARY_DIRS) -endif () + endforeach() + if (LAPACK_LIBRARY_DIRS) + list(REMOVE_DUPLICATES LAPACK_LIBRARY_DIRS) + endif () +endif (NOT LAPACK_LIBRARY_DIRS) # check that LAPACKEXT has been found # ----------------------------------- -- GitLab