-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindsuitesparse.cmake
68 lines (58 loc) · 1.73 KB
/
Findsuitesparse.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
if (TARGET suitesparse::cholmod OR TARGET suitesparse::spqr)
return()
endif()
include(FindPackageHandleStandardArgs)
if (APPLE)
file(GLOB SUITESPARSE_DIRS
/usr/local/Cellar/suitesparse/*
/opt/homebrew/Cellar/suitesparse/*
/usr/local/Cellar/suite-sparse/*
/opt/homebrew/Cellar/suite-sparse/*
)
else ()
set(SUITESPARSE_DIRS /usr/include/suitesparse)
endif()
find_path(suitesparse_cholmod_INCLUDE_DIR
NAMES cholmod.h
HINTS ${SUITESPARSE_DIRS}
PATH_SUFFIXES "include" "include/suitesparse"
)
find_path(suitesparse_spqr_INCLUDE_DIR
NAMES SuiteSparseQR.hpp
HINTS ${SUITESPARSE_DIRS}
PATH_SUFFIXES "include" "include/suitesparse"
)
find_library(suitesparse_cholmod_LIBRARY
NAMES cholmod
HINTS ${SUITESPARSE_DIRS}
PATH_SUFFIXES lib
)
find_library(suitesparse_spqr_LIBRARY
NAMES spqr
HINTS ${SUITESPARSE_DIRS}
PATH_SUFFIXES lib
)
find_package_handle_standard_args(suitesparse REQUIRED_VARS
suitesparse_cholmod_LIBRARY
suitesparse_spqr_LIBRARY
suitesparse_cholmod_INCLUDE_DIR
suitesparse_spqr_INCLUDE_DIR
)
if (suitesparse_FOUND)
mark_as_advanced(suitesparse_cholmod_LIBRARY)
mark_as_advanced(suitesparse_cholmod_INCLUDE_DIR)
add_library(suitesparse::cholmod UNKNOWN IMPORTED)
set_target_properties(suitesparse::cholmod
PROPERTIES
IMPORTED_LOCATION ${suitesparse_cholmod_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${suitesparse_cholmod_INCLUDE_DIR}
)
mark_as_advanced(suitesparse_spqr_LIBRARY)
mark_as_advanced(suitesparse_spqr_INCLUDE_DIR)
add_library(suitesparse::spqr UNKNOWN IMPORTED)
set_target_properties(suitesparse::spqr
PROPERTIES
IMPORTED_LOCATION ${suitesparse_spqr_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${suitesparse_spqr_INCLUDE_DIR}
)
endif ()