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.

80 lines
1.9 KiB

  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. if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
  4. set(SUPERLU_FIND_QUIETLY TRUE)
  5. endif (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
  6. find_path(SUPERLU_INCLUDES
  7. NAMES
  8. supermatrix.h
  9. PATHS
  10. $ENV{SUPERLUDIR}
  11. ${INCLUDE_INSTALL_DIR}
  12. PATH_SUFFIXES
  13. superlu
  14. SRC
  15. )
  16. find_library(SUPERLU_LIBRARIES NAMES "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu" PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR} PATH_SUFFIXES lib)
  17. if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
  18. include(CheckCXXSourceCompiles)
  19. include(CMakePushCheckState)
  20. cmake_push_check_state()
  21. set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDES})
  22. # check whether struct mem_usage_t is globally defined
  23. check_cxx_source_compiles("
  24. typedef int int_t;
  25. #include <supermatrix.h>
  26. #include <slu_util.h>
  27. int main() {
  28. mem_usage_t mem;
  29. return 0;
  30. }"
  31. SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
  32. check_cxx_source_compiles("
  33. typedef int int_t;
  34. #include <supermatrix.h>
  35. #include <superlu_enum_consts.h>
  36. int main() {
  37. return SLU_SINGLE;
  38. }"
  39. SUPERLU_HAS_CLEAN_ENUMS)
  40. if(SUPERLU_HAS_CLEAN_ENUMS)
  41. # at least 4.3
  42. set(SUPERLU_VERSION_VAR "4.3")
  43. elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
  44. # at least 4.3
  45. set(SUPERLU_VERSION_VAR "4.0")
  46. else()
  47. set(SUPERLU_VERSION_VAR "3.0")
  48. endif()
  49. cmake_pop_check_state()
  50. if(SuperLU_FIND_VERSION)
  51. if(${SUPERLU_VERSION_VAR} VERSION_LESS ${SuperLU_FIND_VERSION})
  52. set(SUPERLU_VERSION_OK FALSE)
  53. else()
  54. set(SUPERLU_VERSION_OK TRUE)
  55. endif()
  56. else()
  57. set(SUPERLU_VERSION_OK TRUE)
  58. endif()
  59. endif()
  60. include(FindPackageHandleStandardArgs)
  61. find_package_handle_standard_args(SUPERLU
  62. REQUIRED_VARS SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK
  63. VERSION_VAR SUPERLU_VERSION_VAR)
  64. mark_as_advanced(SUPERLU_INCLUDES SUPERLU_LIBRARIES)