You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.5 KiB

  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. if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)
  4. set(CHOLMOD_FIND_QUIETLY TRUE)
  5. endif (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)
  6. find_path(CHOLMOD_INCLUDES
  7. NAMES
  8. cholmod.h
  9. PATHS
  10. $ENV{CHOLMODDIR}
  11. ${INCLUDE_INSTALL_DIR}
  12. PATH_SUFFIXES
  13. suitesparse
  14. ufsparse
  15. )
  16. find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  17. if(CHOLMOD_LIBRARIES)
  18. get_filename_component(CHOLMOD_LIBDIR ${CHOLMOD_LIBRARIES} PATH)
  19. find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  20. if (AMD_LIBRARY)
  21. set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${AMD_LIBRARY})
  22. else ()
  23. set(CHOLMOD_LIBRARIES FALSE)
  24. endif ()
  25. endif(CHOLMOD_LIBRARIES)
  26. if(CHOLMOD_LIBRARIES)
  27. find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  28. if (COLAMD_LIBRARY)
  29. set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${COLAMD_LIBRARY})
  30. else ()
  31. set(CHOLMOD_LIBRARIES FALSE)
  32. endif ()
  33. endif(CHOLMOD_LIBRARIES)
  34. if(CHOLMOD_LIBRARIES)
  35. find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  36. if (CAMD_LIBRARY)
  37. set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CAMD_LIBRARY})
  38. else ()
  39. set(CHOLMOD_LIBRARIES FALSE)
  40. endif ()
  41. endif(CHOLMOD_LIBRARIES)
  42. if(CHOLMOD_LIBRARIES)
  43. find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  44. if (CCOLAMD_LIBRARY)
  45. set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CCOLAMD_LIBRARY})
  46. else ()
  47. set(CHOLMOD_LIBRARIES FALSE)
  48. endif ()
  49. endif(CHOLMOD_LIBRARIES)
  50. if(CHOLMOD_LIBRARIES)
  51. find_library(CHOLMOD_METIS_LIBRARY metis PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  52. if (CHOLMOD_METIS_LIBRARY)
  53. set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CHOLMOD_METIS_LIBRARY})
  54. endif ()
  55. endif(CHOLMOD_LIBRARIES)
  56. if(CHOLMOD_LIBRARIES)
  57. find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})
  58. if (SUITESPARSE_LIBRARY)
  59. set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${SUITESPARSE_LIBRARY})
  60. endif (SUITESPARSE_LIBRARY)
  61. endif(CHOLMOD_LIBRARIES)
  62. include(FindPackageHandleStandardArgs)
  63. find_package_handle_standard_args(CHOLMOD DEFAULT_MSG
  64. CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
  65. mark_as_advanced(CHOLMOD_INCLUDES CHOLMOD_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY SUITESPARSE_LIBRARY CAMD_LIBRARY CCOLAMD_LIBRARY CHOLMOD_METIS_LIBRARY)