Home | History | Annotate | Download | only in cmake
      1 # Umfpack lib usually requires linking to a blas library.
      2 # It is up to the user of this module to find a BLAS and link to it.
      3 
      4 if (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
      5   set(UMFPACK_FIND_QUIETLY TRUE)
      6 endif (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
      7 
      8 find_path(UMFPACK_INCLUDES
      9   NAMES
     10   umfpack.h
     11   PATHS
     12   $ENV{UMFPACKDIR}
     13   ${INCLUDE_INSTALL_DIR}
     14   PATH_SUFFIXES
     15   suitesparse
     16   ufsparse
     17 )
     18 
     19 find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
     20 
     21 if(UMFPACK_LIBRARIES)
     22 
     23   if(NOT UMFPACK_LIBDIR)
     24     get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
     25   endif(NOT UMFPACK_LIBDIR)
     26 
     27   find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
     28   if(COLAMD_LIBRARY)
     29     set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
     30   endif ()
     31   
     32   find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
     33   if(AMD_LIBRARY)
     34     set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
     35   endif ()
     36 
     37   find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
     38   if(SUITESPARSE_LIBRARY)
     39     set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${SUITESPARSE_LIBRARY})
     40   endif ()
     41 
     42   find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
     43   if(CHOLMOD_LIBRARY)
     44     set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${CHOLMOD_LIBRARY})
     45   endif()
     46 
     47 endif(UMFPACK_LIBRARIES)
     48 
     49 include(FindPackageHandleStandardArgs)
     50 find_package_handle_standard_args(UMFPACK DEFAULT_MSG
     51                                   UMFPACK_INCLUDES UMFPACK_LIBRARIES)
     52 
     53 mark_as_advanced(UMFPACK_INCLUDES UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY CHOLMOD_LIBRARY SUITESPARSE_LIBRARY)
     54