FindUMFPACK.cmake
Go to the documentation of this file.
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_INCLUDE_DIR AND UMFPACK_LIBRARIES)
6 endif ()
7 
8 find_path(UMFPACK_INCLUDE_DIR
9  NAMES
10  umfpack.h
11  PATHS
12  ${UMFPACK_DIR}/include
13  $ENV{UMFPACKDIR}/include
14  ${INCLUDE_INSTALL_DIR}
15  PATH_SUFFIXES
16  suitesparse
17  ufsparse
18 )
19 
20 find_library(UMFPACK_LIBRARIES
21  NAMES umfpack
22  PATHS
23  ${UMFPACK_DIR}/lib
24  $ENV{UMFPACKDIR}/lib
25  ${LIB_INSTALL_DIR}
26 )
27 
28 if (UMFPACK_LIBRARIES)
29 
30  if (NOT UMFPACK_LIBDIR)
31  get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
32  endif(NOT UMFPACK_LIBDIR)
33 
34  find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR}/lib ${LIB_INSTALL_DIR})
35  if (COLAMD_LIBRARY)
36  set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
37  endif (COLAMD_LIBRARY)
38 
39  find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR}/lib ${LIB_INSTALL_DIR})
40  if (AMD_LIBRARY)
41  set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
42  endif (AMD_LIBRARY)
43 
44  find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR}/lib ${LIB_INSTALL_DIR})
45  if (SUITESPARSE_LIBRARY)
46  set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${SUITESPARSE_LIBRARY})
47  endif (SUITESPARSE_LIBRARY)
48 
49 endif ()
50 
51 include(FindPackageHandleStandardArgs)
52 find_package_handle_standard_args(UMFPACK DEFAULT_MSG
53  UMFPACK_INCLUDE_DIR UMFPACK_LIBRARIES)
54 
55 if (UMFPACK_FOUND)
56  string (REGEX REPLACE "/(suitesparse|ufsparse)/?" "" UMFPACK_DIR "${UMFPACK_INCLUDE_DIR}")
57  get_filename_component(UMFPACK_DIR "${UMFPACK_DIR}" PATH)
58 endif ()
59 
60 mark_as_advanced(UMFPACK_INCLUDE_DIR UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY SUITESPARSE_LIBRARY)
cmake UMFPACK_LIBRARIES
cmake UMFPACK_FIND_QUIETLY
function get_filename_component(inout ARGN)
Fixes CMake's get_filename_component() command.