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})
307 if(NOT $ENV{BLA_VENDOR} STREQUAL "")
308 set(BLA_VENDOR $ENV{BLA_VENDOR})
309 elseif(NOT BLA_VENDOR)
310 set(BLA_VENDOR "All")
313 # LAPACK in the Intel MKL 10+ library?
314 if(NOT LAPACK_LIBRARIES
315 AND (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
316 AND (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED))
317 # System-specific settings
319 set(LAPACK_mkl_LM "-lm")
320 set(LAPACK_mkl_LDL "-ldl")
323 _lapack_find_dependency(Threads)
325 if(_lapack_sizeof_integer EQUAL 8)
326 set(LAPACK_mkl_ILP_MODE "ilp64")
327 elseif(_lapack_sizeof_integer EQUAL 4)
328 set(LAPACK_mkl_ILP_MODE "lp64")
330 if(BLA_VENDOR MATCHES "_64ilp")
331 set(LAPACK_mkl_ILP_MODE "ilp64")
333 set(LAPACK_mkl_ILP_MODE "lp64")
337 set(LAPACK_SEARCH_LIBS "")
340 set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95")
341 set(_LAPACK_LIBRARIES LAPACK95_LIBRARIES)
342 set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES})
345 list(APPEND LAPACK_SEARCH_LIBS
348 list(APPEND LAPACK_SEARCH_LIBS
350 list(APPEND LAPACK_SEARCH_LIBS
351 "mkl_lapack95_${LAPACK_mkl_ILP_MODE}")
353 set(LAPACK_mkl_SEARCH_SYMBOL "cheev")
354 set(_LAPACK_LIBRARIES LAPACK_LIBRARIES)
355 set(_BLAS_LIBRARIES ${BLAS_LIBRARIES})
357 # old and new >= 10.3
358 list(APPEND LAPACK_SEARCH_LIBS
362 # MKL uses a multitude of partially platform-specific subdirectories:
363 if(BLA_VENDOR STREQUAL "Intel10_32")
364 set(LAPACK_mkl_ARCH_NAME "ia32")
366 set(LAPACK_mkl_ARCH_NAME "intel64")
369 set(LAPACK_mkl_OS_NAME "win")
371 set(LAPACK_mkl_OS_NAME "mac")
373 set(LAPACK_mkl_OS_NAME "lin")
375 if(DEFINED ENV{MKLROOT})
376 file(TO_CMAKE_PATH "$ENV{MKLROOT}" LAPACK_mkl_MKLROOT)
377 # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead
378 # so we can better detect other relevant libraries in 'compiler' or 'tbb':
379 get_filename_component(LAPACK_mkl_MKLROOT_LAST_DIR "${LAPACK_mkl_MKLROOT}" NAME)
380 if(LAPACK_mkl_MKLROOT_LAST_DIR STREQUAL "mkl")
381 get_filename_component(LAPACK_mkl_MKLROOT "${LAPACK_mkl_MKLROOT}" DIRECTORY)
384 set(LAPACK_mkl_LIB_PATH_SUFFIXES
385 "compiler/lib" "compiler/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"
386 "compiler/lib/${LAPACK_mkl_ARCH_NAME}"
387 "mkl/lib" "mkl/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"
388 "mkl/lib/${LAPACK_mkl_ARCH_NAME}"
389 "lib" "lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}"
390 "lib/${LAPACK_mkl_ARCH_NAME}"
393 # First try empty lapack libs (implicitly linked or automatic from BLAS)
394 if(NOT ${_LAPACK_LIBRARIES})
395 check_lapack_libraries(
398 ${LAPACK_mkl_SEARCH_SYMBOL}
401 "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
402 "${LAPACK_mkl_MKLROOT}"
403 "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
406 if(LAPACK_WORKS AND NOT _BLAS_LIBRARIES)
407 # Give a more helpful "found" message
408 set(LAPACK_WORKS "implicitly linked")
409 set(_lapack_fphsa_req_var LAPACK_WORKS)
413 # Then try the search libs
414 foreach(_search ${LAPACK_SEARCH_LIBS})
415 string(REPLACE " " ";" _search ${_search})
416 if(NOT ${_LAPACK_LIBRARIES})
417 check_lapack_libraries(
420 ${LAPACK_mkl_SEARCH_SYMBOL}
423 "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}"
424 "${LAPACK_mkl_MKLROOT}"
425 "${LAPACK_mkl_LIB_PATH_SUFFIXES}"
432 unset(LAPACK_mkl_ILP_MODE)
433 unset(LAPACK_mkl_SEARCH_SYMBOL)
435 unset(LAPACK_mkl_LDL)
436 unset(LAPACK_mkl_MKLROOT)
437 unset(LAPACK_mkl_ARCH_NAME)
438 unset(LAPACK_mkl_OS_NAME)
439 unset(LAPACK_mkl_LIB_PATH_SUFFIXES)
442 # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)
443 if(NOT LAPACK_LIBRARIES
444 AND (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All"))
445 check_lapack_libraries(
458 # FlexiBLAS? (http://www.mpi-magdeburg.mpg.de/mpcsc/software/FlexiBLAS/)
459 if(NOT LAPACK_LIBRARIES
460 AND (BLA_VENDOR STREQUAL "FlexiBLAS" OR BLA_VENDOR STREQUAL "All"))
461 set(_lapack_flexiblas_lib "flexiblas")
463 if(_lapack_sizeof_integer EQUAL 8)
464 string(APPEND _lapack_flexiblas_lib "64")
467 check_lapack_libraries(
472 "${_lapack_flexiblas_lib}"
479 unset(_lapack_flexiblas_lib)
482 # OpenBLAS? (http://www.openblas.net)
483 if(NOT LAPACK_LIBRARIES
484 AND (BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All"))
485 set(_lapack_openblas_lib "openblas")
487 if(_lapack_sizeof_integer EQUAL 8)
488 string(APPEND _lapack_openblas_lib "64")
491 check_lapack_libraries(
496 "${_lapack_openblas_lib}"
503 unset(_lapack_openblas_lib)
506 # ArmPL? (https://developer.arm.com/tools-and-software/server-and-hpc/compile/arm-compiler-for-linux/arm-performance-libraries)
507 if(NOT LAPACK_LIBRARIES
508 AND (BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All"))
509 # Check for 64bit Integer support
510 if(_lapack_sizeof_integer EQUAL 8)
511 set(LAPACK_armpl_LIB "armpl_ilp64")
512 elseif(_lapack_sizeof_integer EQUAL 4)
513 set(LAPACK_armpl_LIB "armpl_lp64")
515 if(BLA_VENDOR MATCHES "_ilp64")
516 set(LAPACK_armpl_LIB "armpl_ilp64")
518 set(LAPACK_armpl_LIB "armpl_lp64")
522 # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp
523 if(BLA_VENDOR MATCHES "_mp")
524 string(APPEND LAPACK_armpl_LIB "_mp")
527 check_lapack_libraries(
532 "${LAPACK_armpl_LIB}"
540 # FLAME's blis library? (https://github.com/flame/blis)
541 if(NOT LAPACK_LIBRARIES
542 AND (BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All"))
543 if(_lapack_sizeof_integer EQUAL 8)
544 if(BLA_VENDOR STREQUAL "FLAME")
545 message(FATAL_ERROR "libFLAME does not support Int64 type")
548 check_lapack_libraries(
562 # LAPACK in SCSL library? (SGI/Cray Scientific Library)
563 if(NOT LAPACK_LIBRARIES
564 AND (BLA_VENDOR MATCHES "SCSL" OR BLA_VENDOR STREQUAL "All"))
565 set(_lapack_scsl_lib "scs")
567 if(_lapack_sizeof_integer EQUAL 8)
568 string(APPEND _lapack_scsl_lib "_i8")
570 # Check for OpenMP support, VIA BLA_VENDOR of scs_mp
571 if(BLA_VENDOR MATCHES "_mp")
572 string(APPEND _lapack_scsl_lib "_mp")
575 check_lapack_libraries(
580 "${_lapack_scsl_lib}"
586 unset(_lapack_scsl_lib)
589 # BLAS in acml library?
590 if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All")
591 if(BLAS_LIBRARIES MATCHES ".+acml.+")
592 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
596 # Apple LAPACK library?
597 if(NOT LAPACK_LIBRARIES
598 AND (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All"))
599 if(_lapack_sizeof_integer EQUAL 8)
600 if(BLA_VENDOR STREQUAL "Apple")
601 message(FATAL_ERROR "Accelerate Framework does not support Int64 type")
604 check_lapack_libraries(
618 # Apple NAS (vecLib) library?
619 if(NOT LAPACK_LIBRARIES
620 AND (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All"))
621 if(_lapack_sizeof_integer EQUAL 8)
622 if(BLA_VENDOR STREQUAL "NAS")
623 message(FATAL_ERROR "Accelerate Framework does not support Int64 type")
626 check_lapack_libraries(
640 # Elbrus Math Library?
641 if(NOT LAPACK_LIBRARIES
642 AND (BLA_VENDOR MATCHES "EML" OR BLA_VENDOR STREQUAL "All"))
643 if(BLAS_LIBRARIES MATCHES "eml.+")
644 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
648 # Fujitsu SSL2 Library?
649 if(NOT LAPACK_LIBRARIES
650 AND (BLA_VENDOR MATCHES "Fujitsu_SSL2" OR BLA_VENDOR STREQUAL "All"))
651 if(BLAS_LIBRARIES MATCHES "fjlapack.+")
652 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
653 set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS})
657 # LAPACK in IBM ESSL library?
658 if(NOT LAPACK_LIBRARIES
659 AND (BLA_VENDOR MATCHES "IBMESSL" OR BLA_VENDOR STREQUAL "All"))
660 if(BLAS_LIBRARIES MATCHES "essl.+")
661 set(LAPACK_LIBRARIES ${BLAS_LIBRARIES})
667 if(NOT LAPACK_LIBRARIES
668 AND (BLA_VENDOR MATCHES "NVHPC" OR BLA_VENDOR STREQUAL "All"))
669 set(_lapack_nvhpc_lib "lapack")
671 if(_lapack_sizeof_integer EQUAL 8)
672 string(APPEND _lapack_nvhpc_lib "_ilp64")
673 elseif(_lapack_sizeof_integer EQUAL 4)
674 string(APPEND _lapack_nvhpc_lib "_lp64")
676 set(_lapack_nvhpc_flags)
677 if(";${CMAKE_C_COMPILER_ID};${CMAKE_CXX_COMPILER_ID};${CMAKE_Fortran_COMPILER_ID};" MATCHES ";(NVHPC|PGI);")
678 set(_lapack_nvhpc_flags "-fortranlibs")
681 check_lapack_libraries(
686 "${_lapack_nvhpc_lib}"
687 "${_lapack_nvhpc_flags}"
693 # an additional check for NVHPC 2020
694 # which does not have differentiation
695 # between lp64 and ilp64 modes
696 if(NOT LAPACK_LIBRARIES AND NOT _lapack_sizeof_integer EQUAL 8)
697 set(_lapack_nvhpc_lib "lapack")
699 check_lapack_libraries(
704 "${_lapack_nvhpc_lib}"
705 "${_lapack_nvhpc_flags}"
712 unset(_lapack_nvhpc_lib)
713 unset(_lapack_nvhpc_flags)
716 # Generic LAPACK library?
717 if(NOT LAPACK_LIBRARIES
718 AND (BLA_VENDOR STREQUAL "Generic"
719 OR BLA_VENDOR STREQUAL "ATLAS"
720 OR BLA_VENDOR STREQUAL "All"))
721 set(_lapack_generic_lib "lapack")
723 # We do not know for sure how the LAPACK reference implementation
724 # is built on this host. Guess typical dependencies.
725 set(_lapack_generic_deps "-lgfortran;-lm")
727 set(_lapack_generic_deps "")
730 if(_lapack_sizeof_integer EQUAL 8)
731 string(APPEND _lapack_generic_lib "64")
734 check_lapack_libraries(
739 "${_lapack_generic_lib}"
740 "${_lapack_generic_deps}"
746 unset(_lapack_generic_deps)
747 unset(_lapack_generic_lib)
752 set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}")
755 if(LAPACK_NOT_FOUND_MESSAGE)
756 set(LAPACK_NOT_FOUND_MESSAGE
757 REASON_FAILURE_MESSAGE ${LAPACK_NOT_FOUND_MESSAGE})
759 find_package_handle_standard_args(LAPACK REQUIRED_VARS ${_lapack_fphsa_req_var}
760 ${LAPACK_NOT_FOUND_MESSAGE})
761 unset(LAPACK_NOT_FOUND_MESSAGE)
764 set(LAPACK95_FOUND ${LAPACK_FOUND})
767 # On compilers that implicitly link LAPACK (such as ftn, cc, and CC on Cray HPC machines)
768 # we used a placeholder for empty LAPACK_LIBRARIES to get through our logic above.
769 if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES")
770 set(LAPACK_LIBRARIES "")
774 unset(_lapack_fphsa_req_var)
775 unset(_lapack_sizeof_integer)
776 unset(_LAPACK_LIBRARIES)