Austin Schuh | c55b017 | 2022-02-20 17:52:35 -0800 | [diff] [blame] | 1 | # KLU 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 (KLU_INCLUDES AND KLU_LIBRARIES) |
| 5 | set(KLU_FIND_QUIETLY TRUE) |
| 6 | endif () |
| 7 | |
| 8 | find_path(KLU_INCLUDES |
| 9 | NAMES |
| 10 | klu.h |
| 11 | PATHS |
| 12 | $ENV{KLUDIR} |
| 13 | ${INCLUDE_INSTALL_DIR} |
| 14 | PATH_SUFFIXES |
| 15 | suitesparse |
| 16 | ufsparse |
| 17 | ) |
| 18 | |
| 19 | find_library(KLU_LIBRARIES klu PATHS $ENV{KLUDIR} ${LIB_INSTALL_DIR}) |
| 20 | |
| 21 | if(KLU_LIBRARIES) |
| 22 | |
| 23 | if(NOT KLU_LIBDIR) |
| 24 | get_filename_component(KLU_LIBDIR ${KLU_LIBRARIES} PATH) |
| 25 | endif() |
| 26 | |
| 27 | find_library(COLAMD_LIBRARY colamd PATHS ${KLU_LIBDIR} $ENV{KLUDIR} ${LIB_INSTALL_DIR}) |
| 28 | if(COLAMD_LIBRARY) |
| 29 | set(KLU_LIBRARIES ${KLU_LIBRARIES} ${COLAMD_LIBRARY}) |
| 30 | endif () |
| 31 | |
| 32 | find_library(AMD_LIBRARY amd PATHS ${KLU_LIBDIR} $ENV{KLUDIR} ${LIB_INSTALL_DIR}) |
| 33 | if(AMD_LIBRARY) |
| 34 | set(KLU_LIBRARIES ${KLU_LIBRARIES} ${AMD_LIBRARY}) |
| 35 | endif () |
| 36 | |
| 37 | find_library(BTF_LIBRARY btf PATHS $ENV{KLU_LIBDIR} $ENV{KLUDIR} ${LIB_INSTALL_DIR}) |
| 38 | if(BTF_LIBRARY) |
| 39 | set(KLU_LIBRARIES ${KLU_LIBRARIES} ${BTF_LIBRARY}) |
| 40 | endif() |
| 41 | |
| 42 | endif() |
| 43 | |
| 44 | include(FindPackageHandleStandardArgs) |
| 45 | find_package_handle_standard_args(KLU DEFAULT_MSG |
| 46 | KLU_INCLUDES KLU_LIBRARIES) |
| 47 | |
| 48 | mark_as_advanced(KLU_INCLUDES KLU_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY BTF_LIBRARY) |