summaryrefslogtreecommitdiffstats
path: root/Modules/FindBLAS.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindBLAS.cmake')
-rw-r--r--Modules/FindBLAS.cmake19
1 files changed, 19 insertions, 0 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 0e5fa11..8e8c6f4 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -27,10 +27,17 @@
# to link against to use BLAS95 interface
# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
# is found
+#
+# The following variables can be used to control this module:
+#
+# ::
+#
# BLA_STATIC if set on this determines what kind of linkage we do (static)
# BLA_VENDOR if set checks only the specified vendor, if not set checks
# all the possibilities
# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
+# BLA_PREFER_PKGCONFIG if set pkg-config will be used to search for a BLAS
+# library first and if one is found that is preferred
#
# List of vendors (BLA_VENDOR) valid in this module:
#
@@ -79,6 +86,18 @@ if( NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_C
endif()
endif()
+if(BLA_PREFER_PKGCONFIG)
+ find_package(PkgConfig)
+ pkg_check_modules(PKGC_BLAS IMPORTED_TARGET blas)
+ if(PKGC_BLAS_FOUND)
+ set(BLAS_LIBRARIES PkgConfig::PKGC_BLAS)
+ find_package_handle_standard_args(BLAS
+ REQUIRED_VARS BLAS_LIBRARIES
+ VERSION_VAR PKGC_BLAS_VERSION)
+ return()
+ endif()
+endif()
+
macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the