forked from rpavlik/cmake-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindLAPACKLibs.cmake
94 lines (86 loc) · 2.45 KB
/
FindLAPACKLibs.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# - Try to find LAPACK and BLAS libraries
# Once done, this will define
# LAPACKLIBS_LIBRARIES, all libraries to link against
# LAPACKLIBS_FOUND, If false, do not try to use LAPACK library features.
#
# Users may wish to set:
# LAPACKLIBS_ROOT_DIR, location to start searching for LAPACK libraries
#
# Original Author:
# 2009-2010 Rylie Pavlik <[email protected]>
# https://ryliepavlik.com/
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright 2009-2010, Iowa State University
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#
# SPDX-License-Identifier: BSL-1.0
set(_check)
set(LAPACKLIBS_ROOT_DIR
"${LAPACKLIBS_ROOT_DIR}"
CACHE
PATH
"Directory to search for LAPACK libraries")
if(APPLE)
find_library(LAPACKLIBS_VECLIB_FRAMEWORK veclib)
find_library(LAPACKLIBS_ACCELERATE_FRAMEWORK accelerate)
mark_as_advanced(LAPACKLIBS_VECLIB_FRAMEWORK
LAPACKLIBS_ACCELERATE_FRAMEWORK)
set(LAPACKLIBS_LIBRARIES
"${LAPACKLIBS_VECLIB_FRAMEWORK}"
"${LAPACKLIBS_ACCELERATE_FRAMEWORK}")
list(APPEND
_check
LAPACKLIBS_VECLIB_FRAMEWORK
LAPACKLIBS_ACCELERATE_FRAMEWORK)
elseif(WIN32)
# Tested to work with the files from http://www.fi.muni.cz/~xsvobod2/misc/lapack/
# You might also see http://icl.cs.utk.edu/lapack-for-windows/clapack/index.html for
# the libraries and headers.
# Good luck!
find_library(LAPACKLIBS_LAPACK_LIBRARY
NAMES
lapack_win32_MT
lapack
lapackd
HINTS
${LAPACKLIBS_ROOT_DIR}
PATH_SUFFIXES
lapack-MT-release
lapack-MT-debug
lib)
find_library(LAPACKLIBS_BLAS_LIBRARY
NAMES
blas_win32_MT
blas
blasd
HINTS
${LAPACKLIBS_ROOT_DIR}
PATH_SUFFIXES
lapack-MT-release
lapack-MT-debug
lib)
set(LAPACKLIBS_LIBRARIES
"${LAPACKLIBS_LAPACK_LIBRARY}"
"${LAPACKLIBS_BLAS_LIBRARY}")
list(APPEND _check LAPACKLIBS_LAPACK_LIBRARY LAPACKLIBS_BLAS_LIBRARY)
elseif(UNIX)
# All other Linux/Unix should have lapack without a fuss
list(APPEND _check LAPACKLIBS_LAPACK_LIBRARY)
find_library(LAPACKLIBS_LAPACK_LIBRARY lapack)
set(LAPACKLIBS_LIBRARIES "${LAPACKLIBS_LAPACK_LIBRARY}")
endif()
# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LAPACKLibs
DEFAULT_MSG
${_check})
if(LAPACKLIBS_FOUND)
mark_as_advanced(LAPACKLIBS_ROOT_DIR
LAPACKLIBS_LAPACK_LIBRARY
LAPACKLIBS_BLAS_LIBRARY)
endif()