summaryrefslogtreecommitdiffstats
path: root/Modules/FindBLAS.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/FindBLAS.cmake')
-rw-r--r--Modules/FindBLAS.cmake40
1 files changed, 33 insertions, 7 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index 0aa4f50..77e689f 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -5,12 +5,12 @@
FindBLAS
--------
-Find BLAS library
+Find Basic Linear Algebra Subprograms (BLAS) library
-This module finds an installed fortran library that implements the
+This module finds an installed Fortran library that implements the
BLAS linear-algebra interface (see http://www.netlib.org/blas/). The
-list of libraries searched for is taken from the autoconf macro file,
-acx_blas.m4 (distributed at
+list of libraries searched for is taken from the ``autoconf`` macro file,
+``acx_blas.m4`` (distributed at
http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
Input Variables
@@ -52,7 +52,7 @@ The following variables may be set to influence this module's behavior:
if ``ON`` tries to find the BLAS95 interfaces
``BLA_PREFER_PKGCONFIG``
- if set pkg-config will be used to search for a BLAS library first
+ if set ``pkg-config`` will be used to search for a BLAS library first
and if one is found that is preferred
Result Variables
@@ -63,7 +63,7 @@ This module defines the following variables:
``BLAS_FOUND``
library implementing the BLAS interface is found
``BLAS_LINKER_FLAGS``
- uncached list of required linker flags (excluding -l and -L).
+ uncached list of required linker flags (excluding ``-l`` and ``-L``).
``BLAS_LIBRARIES``
uncached list of libraries (using full path name) to link against
to use BLAS (may be empty if compiler implicitly links BLAS)
@@ -75,7 +75,7 @@ This module defines the following variables:
.. note::
- C or CXX must be enabled to use Intel MKL
+ C or CXX must be enabled to use Intel Math Kernel Library (MKL)
For example, to use Intel MKL libraries and/or Intel compiler:
@@ -83,6 +83,13 @@ This module defines the following variables:
set(BLA_VENDOR Intel10_64lp)
find_package(BLAS)
+
+Hints
+^^^^^
+
+Set ``MKLROOT`` environment variable to a directory that contains an MKL
+installation.
+
#]=======================================================================]
include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
@@ -394,6 +401,24 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
endif ()
endif ()
+ if (DEFINED ENV{MKLROOT})
+ set(_BLAS_MKLROOT_LIB_DIR "$ENV{MKLROOT}")
+ endif ()
+ if (_BLAS_MKLROOT_LIB_DIR)
+ if( SIZEOF_INTEGER EQUAL 8 )
+ set( _BLAS_MKL_PATH_PREFIX "intel64" )
+ else()
+ set( _BLAS_MKL_PATH_PREFIX "ia32" )
+ endif()
+ if (WIN32)
+ string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_win")
+ elseif (APPLE)
+ string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_mac")
+ else ()
+ string(APPEND _BLAS_MKLROOT_LIB_DIR "/lib/${_BLAS_MKL_PATH_PREFIX}_lin")
+ endif ()
+ endif ()
+
foreach (IT ${BLAS_SEARCH_LIBS})
string(REPLACE " " ";" SEARCH_LIBS ${IT})
if (NOT ${_LIBRARIES})
@@ -404,6 +429,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
""
"${SEARCH_LIBS}"
"${CMAKE_THREAD_LIBS_INIT};${BLAS_mkl_LM};${BLAS_mkl_LDL}"
+ "${_BLAS_MKLROOT_LIB_DIR}"
)
endif ()
endforeach ()