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 4 if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES) 5 set(CHOLMOD_FIND_QUIETLY TRUE) 6 endif (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES) 7 8 find_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 19 find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR}) 20 21 if(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 32 endif(CHOLMOD_LIBRARIES) 33 34 if(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 43 endif(CHOLMOD_LIBRARIES) 44 45 if(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 54 endif(CHOLMOD_LIBRARIES) 55 56 if(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 65 endif(CHOLMOD_LIBRARIES) 66 67 if(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 74 endif(CHOLMOD_LIBRARIES) 75 76 include(FindPackageHandleStandardArgs) 77 find_package_handle_standard_args(CHOLMOD DEFAULT_MSG 78 CHOLMOD_INCLUDES CHOLMOD_LIBRARIES) 79 80 mark_as_advanced(CHOLMOD_INCLUDES CHOLMOD_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY) 81