summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-02-03 16:44:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-02-03 16:45:05 (GMT)
commitce7be224764a9ec53f926e517a6ace397f1b9127 (patch)
tree53ead95c62c6fd315f3c73eb7dd786ca71cd74b6
parent999a8663c5479c1e9afff50fbdcb90fea5bc3de4 (diff)
parent807a129f3c4c59d594aea5842d249ba35815d3fb (diff)
downloadCMake-ce7be224764a9ec53f926e517a6ace397f1b9127.zip
CMake-ce7be224764a9ec53f926e517a6ace397f1b9127.tar.gz
CMake-ce7be224764a9ec53f926e517a6ace397f1b9127.tar.bz2
Merge topic 'blas-intel-mkl'
807a129f3c Find{BLAS,LAPACK}: Include parent of points directory in search fe86dc43fe Find{BLAS,LAPACK}: Fixed an incorrect use of a macro argument Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4306
-rw-r--r--Modules/FindBLAS.cmake18
-rw-r--r--Modules/FindLAPACK.cmake17
2 files changed, 25 insertions, 10 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index ed11364..9b6d09c 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -161,14 +161,15 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
set(${LIBRARIES})
set(_combined_name)
+ set(_extaddlibdir "${_addlibdir}")
if(WIN32)
- list(APPEND _addlibdir ENV LIB)
+ list(APPEND _extaddlibdir ENV LIB)
elseif(APPLE)
- list(APPEND _addlibdir ENV DYLD_LIBRARY_PATH)
+ list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH)
else()
- list(APPEND _addlibdir ENV LD_LIBRARY_PATH)
+ list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH)
endif()
- list(APPEND _addlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+ list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
foreach(_library ${_list})
if(_library MATCHES "^-Wl,--(start|end)-group$")
@@ -182,7 +183,7 @@ macro(CHECK_BLAS_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _add
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
- PATHS ${_addlibdir}
+ PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
#message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}")
@@ -448,6 +449,12 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
endif()
if(DEFINED ENV{MKLROOT})
set(BLAS_mkl_MKLROOT "$ENV{MKLROOT}")
+ # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead
+ # so we can better detect other relevant libraries in 'compiler' or 'tbb':
+ get_filename_component(BLAS_mkl_MKLROOT_LAST_DIR "${BLAS_mkl_MKLROOT}" NAME)
+ if(BLAS_mkl_MKLROOT_LAST_DIR STREQUAL "mkl")
+ get_filename_component(BLAS_mkl_MKLROOT "${BLAS_mkl_MKLROOT}" DIRECTORY)
+ endif()
endif()
set(BLAS_mkl_LIB_PATH_SUFFIXES
"compiler/lib" "compiler/lib/${BLAS_mkl_ARCH_NAME}_${BLAS_mkl_OS_NAME}"
@@ -478,6 +485,7 @@ if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
unset(BLAS_mkl_LM)
unset(BLAS_mkl_LDL)
unset(BLAS_mkl_MKLROOT)
+ unset(BLAS_mkl_MKLROOT_LAST_DIR)
unset(BLAS_mkl_ARCH_NAME)
unset(BLAS_mkl_OS_NAME)
unset(BLAS_mkl_LIB_PATH_SUFFIXES)
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 8ade0b1..c962976 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -131,14 +131,15 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a
set(${LIBRARIES})
set(_combined_name)
+ set(_extaddlibdir "${_addlibdir}")
if(WIN32)
- list(APPEND _addlibdir ENV LIB)
+ list(APPEND _extaddlibdir ENV LIB)
elseif(APPLE)
- list(APPEND _addlibdir ENV DYLD_LIBRARY_PATH)
+ list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH)
else()
- list(APPEND _addlibdir ENV LD_LIBRARY_PATH)
+ list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH)
endif()
- list(APPEND _addlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+ list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
foreach(_library ${_list})
if(_library MATCHES "^-Wl,--(start|end)-group$")
@@ -149,7 +150,7 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a
if(_libraries_work)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
- PATHS ${_addlibdir}
+ PATHS ${_extaddlibdir}
PATH_SUFFIXES ${_subdirs}
)
#message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}")
@@ -267,6 +268,12 @@ if(BLAS_FOUND)
endif()
if(DEFINED ENV{MKLROOT})
set(LAPACK_mkl_MKLROOT "$ENV{MKLROOT}")
+ # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead
+ # so we can better detect other relevant libraries in 'compiler' or 'tbb':
+ get_filename_component(LAPACK_mkl_MKLROOT_LAST_DIR "${LAPACK_mkl_MKLROOT}" NAME)
+ if(LAPACK_mkl_MKLROOT_LAST_DIR STREQUAL "mkl")
+ get_filename_component(LAPACK_mkl_MKLROOT "${LAPACK_mkl_MKLROOT}" DIRECTORY)
+ endif()
endif()
set(LAPACK_mkl_LIB_PATH_SUFFIXES
"compiler/lib" "compiler/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"