summaryrefslogtreecommitdiff
path: root/Modules/FindLAPACK.cmake
diff options
context:
space:
mode:
authorJakub Benda <jacob.benda@gmail.com>2019-06-11 16:26:51 +0100
committerBrad King <brad.king@kitware.com>2019-06-17 08:56:05 -0400
commit68dcbeee01a301876011a8310509e3860cbb9b34 (patch)
tree1ef2b496c42498a3ac6b702eba1d754c75063310 /Modules/FindLAPACK.cmake
parent6f7b68e7f969ae39622492b27a6f4bbb79d25117 (diff)
downloadcmake-68dcbeee01a301876011a8310509e3860cbb9b34.tar.gz
FindLAPACK: Test for implicitly linked LAPACK libraries
Apply the change from commit 5b8f69ebe9 (FindBLAS: Detect implicitly linked BLAS library, 2018-08-28, v3.13.0-rc1~150^2~2), to FindLAPACK also. Typically both BLAS and LAPACK are provided the same way, e.g. in a Cray Compiler Environment.
Diffstat (limited to 'Modules/FindLAPACK.cmake')
-rw-r--r--Modules/FindLAPACK.cmake22
1 files changed, 17 insertions, 5 deletions
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index c9c3cce423..844d36ddca 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -173,11 +173,15 @@ if(_libraries_work)
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
endif()
-if(_libraries_work)
- set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads})
-else()
- set(${LIBRARIES} FALSE)
-endif()
+ if(_libraries_work)
+ if("${_list}" STREQUAL "")
+ set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ else()
+ set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threads})
+ endif()
+ else()
+ set(${LIBRARIES} FALSE)
+ endif()
endmacro()
@@ -206,6 +210,7 @@ if(BLAS_FOUND)
#intel lapack
if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
+ if(NOT LAPACK_LIBRARIES)
if (NOT WIN32)
set(LAPACK_mkl_LM "-lm")
set(LAPACK_mkl_LDL "-ldl")
@@ -280,6 +285,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
unset(LAPACK_mkl_LM)
unset(LAPACK_mkl_LDL)
endif ()
+ endif()
endif()
if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
@@ -426,5 +432,11 @@ else()
endif()
endif()
+# On compilers that implicitly link LAPACK (such as ftn, cc, and CC on Cray HPC machines)
+# we used a placeholder for empty LAPACK_LIBRARIES to get through our logic above.
+if (LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
+ set(LAPACK_LIBRARIES "")
+endif()
+
cmake_pop_check_state()
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})