1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
8 Find Linear Algebra PACKage (LAPACK) library
10 This module finds an installed Fortran library that implements the
11 `LAPACK linear-algebra interface`_.
13 At least one of the ``C``, ``CXX``, or ``Fortran`` languages must be enabled.
15 .. _`LAPACK linear-algebra interface`: https://netlib.org/lapack/
20 The following variables may be set to influence this module's behavior:
23 if ``ON`` use static linkage
26 Set to one of the :ref:`BLAS/LAPACK Vendors` to search for BLAS only
27 from the specified vendor. If not set, all vendors are considered.
30 if ``ON`` tries to find the BLAS95/LAPACK95 interfaces
32 ``BLA_PREFER_PKGCONFIG``
33 .. versionadded:: 3.20
35 if set ``pkg-config`` will be used to search for a LAPACK library first
36 and if one is found that is preferred
38 ``BLA_PKGCONFIG_LAPACK``
39 .. versionadded:: 3.25
41 If set, the ``pkg-config`` method will look for this module name instead of
45 ``BLA_SIZEOF_INTEGER``
46 .. versionadded:: 3.22
48 Specify the BLAS/LAPACK library integer size:
51 Search for a BLAS/LAPACK with 32-bit integer interfaces.
53 Search for a BLAS/LAPACK with 64-bit integer interfaces.
55 Search for any BLAS/LAPACK.
56 Most likely, a BLAS/LAPACK with 32-bit integer interfaces will be found.
61 This module defines the following :prop_tgt:`IMPORTED` targets:
64 .. versionadded:: 3.18
66 The libraries to use for LAPACK, if found.
71 This module defines the following variables:
74 library implementing the LAPACK interface is found
75 ``LAPACK_LINKER_FLAGS``
76 uncached list of required linker flags (excluding ``-l`` and ``-L``).
78 uncached list of libraries (using full path name) to link against
80 ``LAPACK95_LIBRARIES``
81 uncached list of libraries (using full path name) to link against
84 library implementing the LAPACK95 interface is found
89 To use the Intel MKL implementation of LAPACK, a project must enable at least
90 one of the ``C`` or ``CXX`` languages. Set ``BLA_VENDOR`` to an Intel MKL
91 variant either on the command-line as ``-DBLA_VENDOR=Intel10_64lp`` or in
96 set(BLA_VENDOR Intel10_64lp)
99 In order to build a project using Intel MKL, and end user must first
100 establish an Intel MKL environment. See the :module:`FindBLAS` module
101 section on :ref:`Intel MKL` for details.
103 #]=======================================================================]
105 # The approach follows that of the ``autoconf`` macro file, ``acx_lapack.m4``
106 # (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).
108 if(CMAKE_Fortran_COMPILER_LOADED)
109 include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
111 include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
113 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
115 function(_add_lapack_target)
116 if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK)
117 add_library(LAPACK::LAPACK INTERFACE IMPORTED)
119 # Filter out redundant BLAS info and replace with the BLAS target
120 set(_lapack_libs "${LAPACK_LIBRARIES}")
121 set(_lapack_flags "${LAPACK_LINKER_FLAGS}")
122 if(TARGET BLAS::BLAS)
123 if(_lapack_libs AND BLAS_LIBRARIES)
124 foreach(_blas_lib IN LISTS BLAS_LIBRARIES)
125 list(REMOVE_ITEM _lapack_libs "${_blas_lib}")
128 if(_lapack_flags AND BLAS_LINKER_FLAGS)
129 foreach(_blas_flag IN LISTS BLAS_LINKER_FLAGS)
130 list(REMOVE_ITEM _lapack_flags "${_blas_flag}")
133 list(APPEND _lapack_libs BLAS::BLAS)
136 set_target_properties(LAPACK::LAPACK PROPERTIES
137 INTERFACE_LINK_LIBRARIES "${_lapack_libs}"
141 set_target_properties(LAPACK::LAPACK PROPERTIES
142 INTERFACE_LINK_OPTIONS "${_lapack_flags}"
148 # TODO: move this stuff to a separate module
150 function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs _blas)
151 # This function checks for the existence of the combination of libraries
152 # given by _list. If the combination is found, this checks whether can link
153 # against that library combination using the name of a routine given by _name
154 # using the linker flags given by _flags. If the combination of libraries is
155 # found and passes the link test, ${LIBRARIES} is set to the list of complete
156 # library paths that have been found. Otherwise, ${LIBRARIES} is set to FALSE.
158 set(_libraries_work TRUE)
164 set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})
166 set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
169 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
170 # for ubuntu's libblas3gf and liblapack3gf packages
171 set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
175 set(_extaddlibdir "${_addlibdir}")
177 list(APPEND _extaddlibdir ENV LIB)
179 list(APPEND _extaddlibdir ENV DYLD_LIBRARY_PATH)
181 list(APPEND _extaddlibdir ENV LD_LIBRARY_PATH)
183 list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
185 foreach(_library ${_list})
186 if(_library MATCHES "^-")
187 # Respect linker flags as-is (required by MKL)
188 list(APPEND _libraries "${_library}")
190 string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}")
191 string(APPEND _combined_name "_${_lib_var}")
192 if(NOT "${_deps}" STREQUAL "")
193 string(APPEND _combined_name "_deps")
196 find_library(${_prefix}_${_lib_var}_LIBRARY
199 PATHS ${_extaddlibdir}
200 PATH_SUFFIXES ${_subdirs}
202 mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY)
203 list(APPEND _libraries ${${_prefix}_${_lib_var}_LIBRARY})
204 set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY})
209 foreach(_flag ${_flags})
210 string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}")
211 string(APPEND _combined_name "_${_flag_var}")
214 # Test this combination of libraries.
215 set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_blas} ${_deps})
216 set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
217 if(CMAKE_Fortran_COMPILER_LOADED)
218 check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
220 check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
222 set(CMAKE_REQUIRED_LIBRARIES)
223 set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
227 if("${_list}${_blas}" STREQUAL "")
228 set(_libraries "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
230 list(APPEND _libraries ${_blas} ${_deps})
233 set(_libraries FALSE)
235 set(${LIBRARIES} "${_libraries}" PARENT_SCOPE)
238 macro(_lapack_find_dependency dep)
239 set(_lapack_quiet_arg)
240 if(LAPACK_FIND_QUIETLY)
241 set(_lapack_quiet_arg QUIET)
243 set(_lapack_required_arg)
244 if(LAPACK_FIND_REQUIRED)
245 set(_lapack_required_arg REQUIRED)
247 find_package(${dep} ${ARGN}
249 ${_lapack_required_arg}
251 if (NOT ${dep}_FOUND)
252 set(LAPACK_NOT_FOUND_MESSAGE "LAPACK could not be found because dependency ${dep} could not be found.")
255 set(_lapack_required_arg)
256 set(_lapack_quiet_arg)
259 set(LAPACK_LINKER_FLAGS)
260 set(LAPACK_LIBRARIES)
261 set(LAPACK95_LIBRARIES)
262 set(_lapack_fphsa_req_var LAPACK_LIBRARIES)
264 # Check the language being used
265 if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED))
266 set(LAPACK_NOT_FOUND_MESSAGE
267 "FindLAPACK requires Fortran, C, or C++ to be enabled.")
270 if(NOT BLA_SIZEOF_INTEGER)
271 # in the reality we do not know which API of BLAS/LAPACK is masked in library
272 set(_lapack_sizeof_integer "ANY")
273 elseif((BLA_SIZEOF_INTEGER STREQUAL "ANY") OR
274 (BLA_SIZEOF_INTEGER STREQUAL "4") OR
275 (BLA_SIZEOF_INTEGER STREQUAL "8"))
276 set(_lapack_sizeof_integer ${BLA_SIZEOF_INTEGER})
278 message(FATAL_ERROR "BLA_SIZEOF_INTEGER can have only <no value>, ANY, 4, or 8 values")
282 if(NOT LAPACK_NOT_FOUND_MESSAGE)
283 _lapack_find_dependency(BLAS)
286 # Search with pkg-config if specified
287 if(BLA_PREFER_PKGCONFIG)
288 if(NOT BLA_PKGCONFIG_LAPACK)
289 set(BLA_PKGCONFIG_LAPACK "lapack")
291 find_package(PkgConfig QUIET)
292 pkg_check_modules(PKGC_LAPACK QUIET ${BLA_PKGCONFIG_LAPACK})
293 if(PKGC_LAPACK_FOUND)
294 set(LAPACK_FOUND TRUE)
295 set(LAPACK_LIBRARIES "${PKGC_LAPACK_LINK_LIBRARIES}")
297 list(APPEND LAPACK_LIBRARIES "${BLAS_LIBRARIES}")
304 # Search for different LAPACK distributions if BLAS is found
305 if(NOT LAPACK_NOT_FOUND_MESSAGE)
306 set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
308 if(NOT "$ENV{BLA_VENDOR}" STREQUAL "")
309 set(BLA_VENDOR "$ENV{BLA_VENDOR}")
311 set(BLA_VENDOR "All")
315 # LAPACK in the Intel MKL 10+ library?
316 if(NOT LAPACK_LIBRARIES
317 AND (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
318 AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
319 # System-specific settings
321 set(LAPACK_mkl_LM "-lm")
322 set(LAPACK_mkl_LDL "-ldl")
325 _lapack_find_dependency(Threads)
327 if(_lapack_sizeof_integer EQUAL 8)
328 set(LAPACK_mkl_ILP_MODE "ilp64")
329 elseif(_lapack_sizeof_integer EQUAL 4)
330 set(LAPACK_mkl_ILP_MODE "lp64")
332 if(BLA_VENDOR MATCHES "_64ilp")
333 set(LAPACK_mkl_ILP_MODE "ilp64")
335 set(LAPACK_mkl_ILP_MODE "lp64")
339 set(LAPACK_SEARCH_LIBS "")
342 set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
343 set(_LAPACK_LIBRARIES LAPACK95_LIBRARIES)
344 set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
347 list(APPEND LAPACK_SEARCH_LIBS
350 list(APPEND LAPACK_SEARCH_LIBS
352 list(APPEND LAPACK_SEARCH_LIBS
353 "mkl_lapack95_${LAPACK_mkl_ILP_MODE}")
355 set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
356 set(_LAPACK_LIBRARIES LAPACK_LIBRARIES)
357 set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
359 # old and new >= 10.3
360 list(APPEND LAPACK_SEARCH_LIBS
364 # MKL uses a multitude of partially platform-specific subdirectories:
365 if(BLA_VENDOR STREQUAL "Intel10_32")
366 set(LAPACK_mkl_ARCH_NAME "ia32")
368 set(LAPACK_mkl_ARCH_NAME "intel64")
371 set(LAPACK_mkl_OS_NAME "win")
373 set(LAPACK_mkl_OS_NAME "mac")
375 set(LAPACK_mkl_OS_NAME "lin")
377 if(DEFINED ENV{MKLROOT})
378 file(TO_CMAKE_PATH "$ENV{MKLROOT}" LAPACK_mkl_MKLROOT)
379 # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead
380 # so we can better detect other relevant libraries in 'compiler' or 'tbb':
381 get_filename_component(LAPACK_mkl_MKLROOT_LAST_DIR "${LAPACK_mkl_MKLROOT}" NAME)
382 if(LAPACK_mkl_MKLROOT_LAST_DIR STREQUAL "mkl")
383 get_filename_component(LAPACK_mkl_MKLROOT "${LAPACK_mkl_MKLROOT}" DIRECTORY)
386 set(LAPACK_mkl_LIB_PATH_SUFFIXES
387 "compiler/lib" "compiler/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"
388 "compiler/lib/${LAPACK_mkl_ARCH_NAME}"
389 "mkl/lib" "mkl/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"
390 "mkl/lib/${LAPACK_mkl_ARCH_NAME}"
391 "lib" "lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"
392 "lib/${LAPACK_mkl_ARCH_NAME}"
395 # First try empty lapack libs (implicitly linked or automatic from BLAS)
396 if(NOT ${_LAPACK_LIBRARIES})
397 check_lapack_libraries(
400 ${LAPACK_mkl_SEARCH_SYMBOL}
403 "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
404 "${LAPACK_mkl_MKLROOT}"
405 "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
408 if(LAPACK_WORKS AND NOT _BLAS_LIBRARIES)
409 # Give a more helpful "found" message
410 set(LAPACK_WORKS "implicitly linked")
411 set(_lapack_fphsa_req_var LAPACK_WORKS)
415 # Then try the search libs
416 foreach(_search ${LAPACK_SEARCH_LIBS})
417 string(REPLACE " " ";" _search ${_search})
418 if(NOT ${_LAPACK_LIBRARIES})
419 check_lapack_libraries(
422 ${LAPACK_mkl_SEARCH_SYMBOL}
425 "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
426 "${LAPACK_mkl_MKLROOT}"
427 "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
434 unset(LAPACK_mkl_ILP_MODE)
435 unset(LAPACK_mkl_SEARCH_SYMBOL)
437 unset(LAPACK_mkl_LDL)
438 unset(LAPACK_mkl_MKLROOT)
439 unset(LAPACK_mkl_ARCH_NAME)
440 unset(LAPACK_mkl_OS_NAME)
441 unset(LAPACK_mkl_LIB_PATH_SUFFIXES)
444 # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
445 if(NOT LAPACK_LIBRARIES
446 AND (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All"))
447 check_lapack_libraries(
460 # FlexiBLAS? (http://www.mpi-magdeburg.mpg.de/mpcsc/software/FlexiBLAS/)
461 if(NOT LAPACK_LIBRARIES
462 AND (BLA_VENDOR STREQUAL "FlexiBLAS" OR BLA_VENDOR STREQUAL "All"))
463 set(_lapack_flexiblas_lib "flexiblas")
465 if(_lapack_sizeof_integer EQUAL 8)
466 string(APPEND _lapack_flexiblas_lib "64")
469 check_lapack_libraries(
474 "${_lapack_flexiblas_lib}"
481 unset(_lapack_flexiblas_lib)
484 # OpenBLAS? (http://www.openblas.net)
485 if(NOT LAPACK_LIBRARIES
486 AND (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All"))
487 set(_lapack_openblas_lib "openblas")
489 if(_lapack_sizeof_integer EQUAL 8)
491 string(APPEND _lapack_openblas_lib "_64")
493 string(APPEND _lapack_openblas_lib "64")
497 check_lapack_libraries(
502 "${_lapack_openblas_lib}"
509 unset(_lapack_openblas_lib)
512 # ArmPL? (https://developer.arm.com/tools-and-software/server-and-hpc/compile/arm-compiler-for-linux/arm-performance-libraries)
513 if(NOT LAPACK_LIBRARIES
514 AND (BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All"))
515 # Check for 64bit Integer support
516 if(_lapack_sizeof_integer EQUAL 8)
517 set(LAPACK_armpl_LIB "armpl_ilp64")
518 elseif(_lapack_sizeof_integer EQUAL 4)
519 set(LAPACK_armpl_LIB "armpl_lp64")
521 if(BLA_VENDOR MATCHES "_ilp64")
522 set(LAPACK_armpl_LIB "armpl_ilp64")
524 set(LAPACK_armpl_LIB "armpl_lp64")
528 # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp
529 if(BLA_VENDOR MATCHES "_mp")
530 string(APPEND LAPACK_armpl_LIB "_mp")
533 check_lapack_libraries(
538 "${LAPACK_armpl_LIB}"
546 # FLAME's blis library? (https://github.com/flame/blis)
547 if(NOT LAPACK_LIBRARIES
548 AND (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All"))
549 if(_lapack_sizeof_integer EQUAL 8)
550 if(BLA_VENDOR STREQUAL "FLAME")
551 message(FATAL_ERROR "libFLAME does not support Int64 type")
554 check_lapack_libraries(
568 # AOCL? (https://developer.amd.com/amd-aocl/)
569 if(NOT LAPACK_LIBRARIES
570 AND (BLA_VENDOR MATCHES "AOCL" OR BLA_VENDOR STREQUAL "All"))
571 if(_lapack_sizeof_integer EQUAL 8)
572 set(_lapack_aocl_subdir "ILP64")
574 set(_lapack_aocl_subdir "LP64")
577 check_lapack_libraries(
585 "${_lapack_aocl_subdir}"
588 unset(_lapack_aocl_subdir)
591 # LAPACK in SCSL library? (SGI/Cray Scientific Library)
592 if(NOT LAPACK_LIBRARIES
593 AND (BLA_VENDOR MATCHES "SCSL" OR BLA_VENDOR STREQUAL "All"))
594 set(_lapack_scsl_lib "scs")
596 if(_lapack_sizeof_integer EQUAL 8)
597 string(APPEND _lapack_scsl_lib "_i8")
599 # Check for OpenMP support, VIA BLA_VENDOR of scs_mp
600 if(BLA_VENDOR MATCHES "_mp")
601 string(APPEND _lapack_scsl_lib "_mp")
604 check_lapack_libraries(
609 "${_lapack_scsl_lib}"
615 unset(_lapack_scsl_lib)
618 # BLAS in acml library?
619 if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
620 if(BLAS_LIBRARIES MATCHES ".+acml.+")
621 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
625 # Apple LAPACK library?
626 if(NOT LAPACK_LIBRARIES
627 AND (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All"))
628 if(_lapack_sizeof_integer EQUAL 8)
629 if(BLA_VENDOR STREQUAL "Apple")
630 message(FATAL_ERROR "Accelerate Framework does not support Int64 type")
633 check_lapack_libraries(
647 # Apple NAS (vecLib) library?
648 if(NOT LAPACK_LIBRARIES
649 AND (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All"))
650 if(_lapack_sizeof_integer EQUAL 8)
651 if(BLA_VENDOR STREQUAL "NAS")
652 message(FATAL_ERROR "Accelerate Framework does not support Int64 type")
655 check_lapack_libraries(
669 # Elbrus Math Library?
670 if(NOT LAPACK_LIBRARIES
671 AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All"))
672 if(BLAS_LIBRARIES MATCHES "eml.+")
673 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
677 # Fujitsu SSL2 Library?
678 if(NOT LAPACK_LIBRARIES
679 AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All"))
680 if(BLAS_LIBRARIES MATCHES "fjlapack.+")
681 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
682 set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
686 # LAPACK in IBM ESSL library?
687 if(NOT LAPACK_LIBRARIES
688 AND (BLA_VENDOR MATCHES "IBMESSL" OR BLA_VENDOR STREQUAL "All"))
689 if(BLAS_LIBRARIES MATCHES "essl.+")
690 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
696 if(NOT LAPACK_LIBRARIES
697 AND (BLA_VENDOR MATCHES "NVHPC" OR BLA_VENDOR STREQUAL "All"))
698 set(_lapack_nvhpc_lib "lapack")
700 if(_lapack_sizeof_integer EQUAL 8)
701 string(APPEND _lapack_nvhpc_lib "_ilp64")
702 elseif(_lapack_sizeof_integer EQUAL 4)
703 string(APPEND _lapack_nvhpc_lib "_lp64")
705 set(_lapack_nvhpc_flags)
706 if(";${CMAKE_C_COMPILER_ID};${CMAKE_CXX_COMPILER_ID};${CMAKE_Fortran_COMPILER_ID};" MATCHES ";(NVHPC|PGI);")
707 set(_lapack_nvhpc_flags "-fortranlibs")
710 check_lapack_libraries(
715 "${_lapack_nvhpc_lib}"
716 "${_lapack_nvhpc_flags}"
722 # an additional check for NVHPC 2020
723 # which does not have differentiation
724 # between lp64 and ilp64 modes
725 if(NOT LAPACK_LIBRARIES AND NOT _lapack_sizeof_integer EQUAL 8)
726 set(_lapack_nvhpc_lib "lapack")
728 check_lapack_libraries(
733 "${_lapack_nvhpc_lib}"
734 "${_lapack_nvhpc_flags}"
741 unset(_lapack_nvhpc_lib)
742 unset(_lapack_nvhpc_flags)
745 # Generic LAPACK library?
746 if(NOT LAPACK_LIBRARIES
747 AND (BLA_VENDOR STREQUAL "Generic"
748 OR BLA_VENDOR STREQUAL "ATLAS"
749 OR BLA_VENDOR STREQUAL "All"))
750 set(_lapack_generic_lib "lapack")
752 # We do not know for sure how the LAPACK reference implementation
753 # is built on this host. Guess typical dependencies.
754 set(_lapack_generic_deps "-lgfortran;-lm")
756 set(_lapack_generic_deps "")
759 if(_lapack_sizeof_integer EQUAL 8)
760 string(APPEND _lapack_generic_lib "64")
763 check_lapack_libraries(
768 "${_lapack_generic_lib}"
769 "${_lapack_generic_deps}"
775 unset(_lapack_generic_deps)
776 unset(_lapack_generic_lib)
781 set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
784 if(LAPACK_NOT_FOUND_MESSAGE)
785 set(LAPACK_NOT_FOUND_MESSAGE
786 REASON_FAILURE_MESSAGE ${LAPACK_NOT_FOUND_MESSAGE})
788 find_package_handle_standard_args(LAPACK REQUIRED_VARS ${_lapack_fphsa_req_var}
789 ${LAPACK_NOT_FOUND_MESSAGE})
790 unset(LAPACK_NOT_FOUND_MESSAGE)
793 set(LAPACK95_FOUND ${LAPACK_FOUND})
796 # On compilers that implicitly link LAPACK (such as ftn, cc, and CC on Cray HPC machines)
797 # we used a placeholder for empty LAPACK_LIBRARIES to get through our logic above.
798 if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
799 set(LAPACK_LIBRARIES "")
803 unset(_lapack_fphsa_req_var)
804 unset(_lapack_sizeof_integer)
805 unset(_LAPACK_LIBRARIES)