| 1 |
# @HEADER |
| 2 |
# ***************************************************************************** |
| 3 |
# Trilinos: An Object-Oriented Solver Framework |
| 4 |
# |
| 5 |
# Copyright 2001-2024 NTESS and the Trilinos contributors. |
| 6 |
# SPDX-License-Identifier: BSD-3-Clause |
| 7 |
# ***************************************************************************** |
| 8 |
# @HEADER |
| 9 |
|
| 10 |
# |
| 11 |
# First, set up the variables for the (backward-compatible) TriBITS way of |
| 12 |
# finding LAPACK. These are used in case find_package(LAPACK ...) is not called |
| 13 |
# or does not find LAPACK. Also, these variables need to be non-null in order |
| 14 |
# to trigger the right behavior in the function |
| 15 |
# tribits_tpl_find_include_dirs_and_libraries(). |
| 16 |
# |
| 17 |
set(REQUIRED_LIBS_NAMES "lapack lapack_win32 openblas") |
| 18 |
|
| 19 |
# |
| 20 |
# Second, search for LAPACK components (if allowed) using the standard |
| 21 |
# find_package(LAPACK ...). |
| 22 |
# |
| 23 |
tribits_tpl_allow_pre_find_package(LAPACK LAPACK_ALLOW_PREFIND) |
| 24 |
if (LAPACK_ALLOW_PREFIND) |
| 25 |
|
| 26 |
message("-- Using find_package(LAPACK ...) ...") |
| 27 |
|
| 28 |
find_package(LAPACK) |
| 29 |
|
| 30 |
if (LAPACK_FOUND) |
| 31 |
# Tell TriBITS that we found LAPACK and there no need to look any further! |
| 32 |
set(TPL_LAPACK_INCLUDE_DIRS "" CACHE PATH |
| 33 |
"LAPACK include dirs") |
| 34 |
set(TPL_LAPACK_LIBRARIES ${LAPACK_LIBRARIES} CACHE FILEPATH |
| 35 |
"LAPACK libraries") |
| 36 |
set(TPL_LAPACK_LIBRARY_DIRS "" CACHE PATH |
| 37 |
"LAPACK library dirs") |
| 38 |
endif() |
| 39 |
|
| 40 |
endif() |
| 41 |
|
| 42 |
if (MSVC AND NOT |
| 43 |
(LAPACK_LIBRARY_DIRS OR |
| 44 |
(NOT "${LAPACK_LIBRARY_NAMES}" STREQUAL "lapack lapack_win32" AND |
| 45 |
NOT "${LAPACK_LIBRARY_NAMES}" STREQUAL "") OR |
| 46 |
LAPACK_INCLUDE_DIRS OR |
| 47 |
LAPACK_INCLUDE_NAMES OR |
| 48 |
(NOT "${TPL_LAPACK_LIBRARIES}" STREQUAL "lapack" AND |
| 49 |
NOT "${TPL_LAPACK_LIBRARIES}" STREQUAL "") OR |
| 50 |
TPL_LAPACK_INCLUDE_DIRS) |
| 51 |
) |
| 52 |
if(CLAPACK_FOUND) |
| 53 |
advanced_set(TPL_LAPACK_LIBRARIES lapack |
| 54 |
CACHE FILEPATH "Set from MSVC CLAPACK specialization") |
| 55 |
endif() |
| 56 |
endif() |
| 57 |
|
| 58 |
# |
| 59 |
# Third, call tribits_tpl_find_include_dirs_and_libraries() |
| 60 |
# |
| 61 |
tribits_tpl_find_include_dirs_and_libraries( LAPACK |
| 62 |
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} |
| 63 |
) |
| 64 |
# NOTE: If find_package(LAPACK ...) was called and successfully found LAPACK, then |
| 65 |
# tribits_tpl_find_include_dirs_and_libraries() will use the already-set |
| 66 |
# variables TPL_LAPACK_INCLUDE_DIRS and TPL_LAPACK_LIBRARIES and then print them |
| 67 |
# out (and set some other standard variables as well). This is the final |