/usr/share/dune/cmake/modules/FindGMP.cmake is in libdune-common-dev 2.5.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | # .. cmake_module::
#
# Find the GNU MP Bignum (GMP) library
#
# You may set the following variables to modify the
# behaviour of this module:
#
# :ref:`GMP_ROOT`
# Path list to search for GMP
#
# Sets the following variables:
#
# :code:`GMP_FOUND`
# True if the GMP library was found.
#
# .. cmake_variable:: GMP_ROOT
#
# You may set this variable to have :ref:`FindGMP` look
# for the gmp package in the given path before inspecting
# system paths.
#
# search for location of header gmpxx.h", only at positions given by the user
find_path(GMP_INCLUDE_DIR
NAMES "gmpxx.h"
PATHS ${GMP_PREFIX} ${GMP_ROOT}
PATH_SUFFIXES include
NO_DEFAULT_PATH)
# try default paths now
find_path(GMP_INCLUDE_DIR
NAMES "gmpxx.h")
# check if header is accepted
include(CMakePushCheckState)
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${GMP_INCLUDE_DIR})
include(CheckIncludeFileCXX)
check_include_file_cxx("gmpxx.h" GMP_HEADER_WORKS)
# look for library gmp, only at positions given by the user
find_library(GMP_LIB gmp
PATHS ${GMP_PREFIX} ${GMP_ROOT}
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH
DOC "GNU GMP library")
# try default paths now
find_library(GMP_LIB gmp)
# look for library gmpxx, only at positions given by the user
find_library(GMPXX_LIB gmpxx
PATHS ${GMP_PREFIX} ${GMP_ROOT}
PATH_SUFFIXES lib lib64
NO_DEFAULT_PATH
DOC "GNU GMPXX library")
# try default paths now
find_library(GMPXX_LIB gmpxx)
# check if library works
if(GMP_LIB AND GMPXX_LIB)
include(CheckSymbolExists)
check_library_exists(${GMP_LIB} __gmpz_abs "" GMPXX_LIB_WORKS)
endif(GMP_LIB AND GMPXX_LIB)
cmake_pop_check_state()
# behave like a CMake module is supposed to behave
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
"GMP"
DEFAULT_MSG
GMP_INCLUDE_DIR GMP_LIB GMPXX_LIB GMP_HEADER_WORKS GMPXX_LIB_WORKS
)
mark_as_advanced(GMP_LIB GMPXX_LIB GMP_INCLUDE_DIR)
# if both headers and library are found, store results
if(GMP_FOUND)
set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR})
set(GMP_LIBRARIES ${GMP_LIB} ${GMPXX_LIB})
set(GMP_COMPILE_FLAGS "-DENABLE_GMP=1")
# log result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Determing location of GMP succeeded:\n"
"Include directory: ${GMP_INCLUDE_DIRS}\n"
"Library directory: ${GMP_LIBRARIES}\n\n")
else(GMP_FOUND)
# log errornous result
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determing location of GMP failed:\n"
"Include directory: ${GMP_INCLUDE_DIR}\n"
"gmp library directory: ${GMP_LIB}\n"
"gmpx library directory: ${GMPXX_LIB}\n\n")
endif(GMP_FOUND)
# set HAVE_GMP for config.h
set(HAVE_GMP ${GMP_FOUND})
# register all GMP related flags
if(HAVE_GMP)
dune_register_package_flags(COMPILE_DEFINITIONS "ENABLE_GMP=1"
LIBRARIES "${GMP_LIB};${GMPXX_LIB}"
INCLUDE_DIRS "${GMP_INCLUDE_DIR}")
endif()
|