• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2# Umfpack lib usually requires linking to a blas library.
3# It is up to the user of this module to find a BLAS and link to it.
4
5if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
6  set(SUPERLU_FIND_QUIETLY TRUE)
7endif (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
8
9find_path(SUPERLU_INCLUDES
10  NAMES
11  supermatrix.h
12  PATHS
13  $ENV{SUPERLUDIR}
14  ${INCLUDE_INSTALL_DIR}
15  PATH_SUFFIXES
16  superlu
17  SRC
18)
19
20find_library(SUPERLU_LIBRARIES
21  NAMES "superlu_5.2.1" "superlu_5.2" "superlu_5.1.1" "superlu_5.1" "superlu_5.0" "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"
22  PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR}
23  PATH_SUFFIXES lib)
24
25if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)
26
27include(CheckCXXSourceCompiles)
28include(CMakePushCheckState)
29cmake_push_check_state()
30
31set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDES})
32
33# check whether struct mem_usage_t is globally defined
34check_cxx_source_compiles("
35typedef int int_t;
36#include <supermatrix.h>
37#include <slu_util.h>
38int main() {
39  mem_usage_t mem;
40  return 0;
41}"
42SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
43
44
45check_cxx_source_compiles("
46typedef int int_t;
47#include <supermatrix.h>
48#include <superlu_enum_consts.h>
49int main() {
50  return SLU_SINGLE;
51}"
52SUPERLU_HAS_CLEAN_ENUMS)
53
54check_cxx_source_compiles("
55typedef int int_t;
56#include <supermatrix.h>
57#include <slu_util.h>
58int main(void)
59{
60  GlobalLU_t glu;
61  return 0;
62}"
63SUPERLU_HAS_GLOBALLU_T)
64
65if(SUPERLU_HAS_GLOBALLU_T)
66  # at least 5.0
67  set(SUPERLU_VERSION_VAR "5.0")
68elseif(SUPERLU_HAS_CLEAN_ENUMS)
69  # at least 4.3
70  set(SUPERLU_VERSION_VAR "4.3")
71elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)
72  # at least 4.0
73  set(SUPERLU_VERSION_VAR "4.0")
74else()
75  set(SUPERLU_VERSION_VAR "3.0")
76endif()
77
78cmake_pop_check_state()
79
80if(SuperLU_FIND_VERSION)
81  if(${SUPERLU_VERSION_VAR} VERSION_LESS ${SuperLU_FIND_VERSION})
82    set(SUPERLU_VERSION_OK FALSE)
83  else()
84    set(SUPERLU_VERSION_OK TRUE)
85  endif()
86else()
87  set(SUPERLU_VERSION_OK TRUE)
88endif()
89
90endif()
91
92include(FindPackageHandleStandardArgs)
93find_package_handle_standard_args(SUPERLU
94                                  REQUIRED_VARS SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK
95                                  VERSION_VAR SUPERLU_VERSION_VAR)
96
97mark_as_advanced(SUPERLU_INCLUDES SUPERLU_LIBRARIES)
98