File: FindARPACK.cmake

package info (click to toggle)
igraph 0.10.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 16,176 kB
  • sloc: ansic: 121,500; cpp: 21,699; xml: 2,734; python: 411; makefile: 147; javascript: 20; sh: 9
file content (85 lines) | stat: -rw-r--r-- 2,474 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# https://raw.githubusercontent.com/dune-project/dune-istl/master/cmake/modules/FindARPACK.cmake
#
# This file is taken from:
#
# DUNE, the Distributed and Unified Numerics Environment
# GPLv2 licensed
#
# .. cmake_module::
#
#    Module that checks whether ARPACK is available and usable.
#
#    Variables used by this module which you may want to set:
#
#    :ref:`ARPACK_ROOT`
#       Path list to search for ARPACK.
#
#    Sets the following variables:
#
#    :code:`ARPACK_FOUND`
#       True if ARPACK available.
#
#    :code:`ARPACK_LIBRARIES`
#       Link against these libraries to use ARPACK.
#
# .. cmake_variable:: ARPACK_ROOT
#
#    You may set this variable to have :ref:`FindARPACK` look
#    for the ARPACK package in the given path before inspecting
#    system paths.
#

# look for library, only at positions given by the user
find_library(ARPACK_LIBRARY
  NAMES "arpack"
  PATHS ${ARPACK_PREFIX} ${ARPACK_ROOT}
  PATH_SUFFIXES "lib" "lib32" "lib64"
  NO_DEFAULT_PATH
)

# look for library files, including default paths
find_library(ARPACK_LIBRARY
  NAMES "arpack"
  PATH_SUFFIXES "lib" "lib32" "lib64"
)

# check header usability
include(CMakePushCheckState)
cmake_push_check_state()

# we need if clauses here because variable is set variable-NOTFOUND if the
# searches above were not successful; without them CMake print errors like:
# "CMake Error: The following variables are used in this project, but they
# are set to NOTFOUND. Please set them or make sure they are set and tested
# correctly in the CMake files."
if(ARPACK_LIBRARY)
  set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ARPACK_LIBRARY})
endif()

# end of header usability check
cmake_pop_check_state()

# behave like a CMake module is supposed to behave
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  "ARPACK"
  DEFAULT_MSG
  ARPACK_LIBRARY
)

# hide the introduced cmake cached variables in cmake GUIs
mark_as_advanced(ARPACK_LIBRARY)

# if headers are found, store results
if(ARPACK_FOUND)
  set(ARPACK_LIBRARIES ${ARPACK_LIBRARY})
  # log result
  file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
    "Determing location of ARPACK succeeded:\n"
    "Libraries to link against: ${ARPACK_LIBRARIES}\n\n")
else()
  # log errornous result
  file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
    "Determing location of ARPACK failed:\n"
    "Libraries to link against: ${ARPACK_LIBRARIES}\n\n")
endif()