Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 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 | |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 23 | if(NOT UMFPACK_LIBDIR) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 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}) |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 28 | if(COLAMD_LIBRARY) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 29 | set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY}) |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 30 | endif () |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 31 | |
| 32 | find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR}) |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 33 | if(AMD_LIBRARY) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 34 | set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY}) |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 35 | endif () |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 36 | |
| 37 | find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR}) |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 38 | if(SUITESPARSE_LIBRARY) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 39 | set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${SUITESPARSE_LIBRARY}) |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 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() |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 46 | |
| 47 | endif(UMFPACK_LIBRARIES) |
| 48 | |
| 49 | include(FindPackageHandleStandardArgs) |
| 50 | find_package_handle_standard_args(UMFPACK DEFAULT_MSG |
| 51 | UMFPACK_INCLUDES UMFPACK_LIBRARIES) |
| 52 | |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame^] | 53 | mark_as_advanced(UMFPACK_INCLUDES UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY CHOLMOD_LIBRARY SUITESPARSE_LIBRARY) |