1find_path(CHOLMOD_INCLUDE_DIR NAMES cholmod.h amd.h camd.h
2    PATHS
3    ${SUITE_SPARSE_ROOT}/include
4    /usr/local/include/suitesparse
5    /usr/local/include/ufsparse
6    /opt/local/include/ufsparse
7    /usr/local/include/ufsparse
8    /sw/include/ufsparse
9  )
10
11find_library(CHOLMOD_LIBRARY NAMES cholmod
12     PATHS
13     ${SUITE_SPARSE_ROOT}/lib
14     /usr/lib
15     /usr/local/lib
16     /opt/local/lib
17     /sw/lib
18   )
19
20find_library(AMD_LIBRARY NAMES SHARED NAMES amd
21  PATHS
22  ${SUITE_SPARSE_ROOT}/lib
23  /usr/lib
24  /usr/local/lib
25  /opt/local/lib
26  /sw/lib
27  )
28
29find_library(CAMD_LIBRARY NAMES camd
30  PATHS
31  ${SUITE_SPARSE_ROOT}/lib
32  /usr/lib
33  /usr/local/lib
34  /opt/local/lib
35  /sw/lib
36  )
37
38find_library(SUITESPARSECONFIG_LIBRARY NAMES suitesparseconfig
39  PATHS
40  ${SUITE_SPARSE_ROOT}/lib
41  /usr/lib
42  /usr/local/lib
43  /opt/local/lib
44  /sw/lib
45  )
46
47
48# Different platforms seemingly require linking against different sets of libraries
49if(CYGWIN)
50  find_package(PkgConfig)
51  find_library(COLAMD_LIBRARY NAMES colamd
52    PATHS
53    /usr/lib
54    /usr/local/lib
55    /opt/local/lib
56    /sw/lib
57    )
58  PKG_CHECK_MODULES(LAPACK lapack)
59
60  set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARY} ${AMD_LIBRARY} ${CAMD_LIBRARY} ${COLAMD_LIBRARY} ${CCOLAMD_LIBRARY} ${LAPACK_LIBRARIES})
61
62# MacPorts build of the SparseSuite requires linking against extra libraries
63
64elseif(APPLE)
65
66  find_library(COLAMD_LIBRARY NAMES colamd
67    PATHS
68    /usr/lib
69    /usr/local/lib
70    /opt/local/lib
71    /sw/lib
72    )
73
74  find_library(CCOLAMD_LIBRARY NAMES ccolamd
75    PATHS
76    /usr/lib
77    /usr/local/lib
78    /opt/local/lib
79    /sw/lib
80    )
81
82  find_library(METIS_LIBRARY NAMES metis
83    PATHS
84    /usr/lib
85    /usr/local/lib
86    /opt/local/lib
87    /sw/lib
88    )
89
90  set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARY} ${AMD_LIBRARY} ${CAMD_LIBRARY} ${COLAMD_LIBRARY} ${CCOLAMD_LIBRARY} ${METIS_LIBRARY} "-framework Accelerate")
91else(APPLE)
92  set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARY} ${AMD_LIBRARY})
93endif(CYGWIN)
94
95if(CHOLMOD_INCLUDE_DIR AND CHOLMOD_LIBRARIES)
96  set(CHOLMOD_FOUND TRUE)
97else(CHOLMOD_INCLUDE_DIR AND CHOLMOD_LIBRARIES)
98  set(CHOLMOD_FOUND FALSE)
99endif(CHOLMOD_INCLUDE_DIR AND CHOLMOD_LIBRARIES)
100
101# Look for csparse; note the difference in the directory specifications!
102find_path(CSPARSE_INCLUDE_DIR NAMES cs.h
103  PATHS
104  /usr/local/include/suitesparse
105  /usr/local/include
106  /opt/local/include
107  /usr/local/include
108  /sw/include
109  /usr/local/include/ufsparse
110  /opt/local/include/ufsparse
111  /usr/local/include/ufsparse
112  /sw/include/ufsparse
113  )
114
115find_library(CSPARSE_LIBRARY NAMES cxsparse
116  PATHS
117  /usr/lib
118  /usr/local/lib
119  /opt/local/lib
120  /sw/lib
121  )
122
123if(CSPARSE_INCLUDE_DIR AND CSPARSE_LIBRARY)
124  set(CSPARSE_FOUND TRUE)
125else(CSPARSE_INCLUDE_DIR AND CSPARSE_LIBRARY)
126  set(CSPARSE_FOUND FALSE)
127endif(CSPARSE_INCLUDE_DIR AND CSPARSE_LIBRARY)
128