1# Cholmod lib usually requires linking to a blas and lapack library. 2# It is up to the user of this module to find a BLAS and link to it. 3 4if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES) 5 set(CHOLMOD_FIND_QUIETLY TRUE) 6endif (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES) 7 8find_path(CHOLMOD_INCLUDES 9 NAMES 10 cholmod.h 11 PATHS 12 $ENV{CHOLMODDIR} 13 ${INCLUDE_INSTALL_DIR} 14 PATH_SUFFIXES 15 suitesparse 16 ufsparse 17) 18 19find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 20 21if(CHOLMOD_LIBRARIES) 22 23 get_filename_component(CHOLMOD_LIBDIR ${CHOLMOD_LIBRARIES} PATH) 24 25 find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 26 if (AMD_LIBRARY) 27 set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${AMD_LIBRARY}) 28 else () 29 set(CHOLMOD_LIBRARIES FALSE) 30 endif () 31 32endif(CHOLMOD_LIBRARIES) 33 34if(CHOLMOD_LIBRARIES) 35 36 find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 37 if (COLAMD_LIBRARY) 38 set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${COLAMD_LIBRARY}) 39 else () 40 set(CHOLMOD_LIBRARIES FALSE) 41 endif () 42 43endif(CHOLMOD_LIBRARIES) 44 45if(CHOLMOD_LIBRARIES) 46 47 find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 48 if (CAMD_LIBRARY) 49 set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CAMD_LIBRARY}) 50 else () 51 set(CHOLMOD_LIBRARIES FALSE) 52 endif () 53 54endif(CHOLMOD_LIBRARIES) 55 56if(CHOLMOD_LIBRARIES) 57 58 find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 59 if (CCOLAMD_LIBRARY) 60 set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CCOLAMD_LIBRARY}) 61 else () 62 set(CHOLMOD_LIBRARIES FALSE) 63 endif () 64 65endif(CHOLMOD_LIBRARIES) 66 67if(CHOLMOD_LIBRARIES) 68 69 find_library(CHOLMOD_METIS_LIBRARY metis PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 70 if (CHOLMOD_METIS_LIBRARY) 71 set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CHOLMOD_METIS_LIBRARY}) 72 endif () 73 74endif(CHOLMOD_LIBRARIES) 75 76if(CHOLMOD_LIBRARIES) 77 78 find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 79 if (SUITESPARSE_LIBRARY) 80 set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${SUITESPARSE_LIBRARY}) 81 endif (SUITESPARSE_LIBRARY) 82 83endif(CHOLMOD_LIBRARIES) 84 85include(FindPackageHandleStandardArgs) 86find_package_handle_standard_args(CHOLMOD DEFAULT_MSG 87 CHOLMOD_INCLUDES CHOLMOD_LIBRARIES) 88 89mark_as_advanced(CHOLMOD_INCLUDES CHOLMOD_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY SUITESPARSE_LIBRARY CAMD_LIBRARY CCOLAMD_LIBRARY CHOLMOD_METIS_LIBRARY) 90