2016-04-05 02:19:31 +01:00
|
|
|
#
|
2016-02-28 19:32:55 +00:00
|
|
|
# - Find GMP/MPIR libraries and headers
|
|
|
|
# This module defines the following variables:
|
2014-12-04 07:59:30 +00:00
|
|
|
#
|
2016-02-28 19:32:55 +00:00
|
|
|
# GMP_FOUND - true if GMP/MPIR was found
|
|
|
|
# GMP_INCLUDE_DIRS - include search path
|
2016-04-05 02:19:31 +01:00
|
|
|
# GMP_LIBRARIES - libraries to link with
|
|
|
|
# GMP_LIBRARY_DLL - library DLL to install. Only available on WIN32.
|
2016-02-28 19:32:55 +00:00
|
|
|
# GMP_LIBRARIES_DIR - the directory the library we link with is found in.
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2017-11-11 22:48:09 +00:00
|
|
|
|
2016-05-30 11:23:36 +01:00
|
|
|
if (ANDROID)
|
2017-11-21 15:44:43 +00:00
|
|
|
|
2018-02-23 09:49:55 +00:00
|
|
|
set( GMP_ROOT ${CMAKE_SOURCE_DIR}/../gmp/${ANDROID_ABI} )
|
2018-02-21 17:41:00 +00:00
|
|
|
if (EXISTS ${GMP_ROOT} )
|
|
|
|
message("Looking good for ${GMP_ROOT}")
|
|
|
|
set(GMP_INCLUDE_DIRS ${GMP_ROOT} CACHE PATH "include search path")
|
|
|
|
set(GMP_LIBRARIES ${GMP_ROOT}/libgmp.so CACHE FILEPATH "include search path")
|
|
|
|
set(GMP_LIBRARIES_DIR ${GMP_ROOT} CACHE PATH "include search path")
|
2017-11-21 15:44:43 +00:00
|
|
|
else()
|
2018-02-21 17:41:00 +00:00
|
|
|
message("Bad call: ${GMP_ROOT} does not exist")
|
2017-11-21 15:44:43 +00:00
|
|
|
endif()
|
|
|
|
find_path(GMP_INCLUDE_DIRS
|
|
|
|
NAMES gmp.h
|
2018-02-21 17:41:00 +00:00
|
|
|
HINTS ${GMP_ROOT}
|
2017-11-21 15:44:43 +00:00
|
|
|
NO_SYSTEM_ENVIRONMENT_PATH)
|
|
|
|
find_library(GMP_LIBRARIES NAMES gmp
|
|
|
|
PATHS
|
|
|
|
${GMP_ROOT}
|
|
|
|
NO_SYSTEM_ENVIRONMENT_PATH)
|
|
|
|
|
|
|
|
|
|
|
|
elseif(MSVC)
|
2016-04-08 09:14:08 +01:00
|
|
|
find_library(GMP_LIBRARIES NAMES mpir mpird
|
2017-10-11 02:24:15 +01:00
|
|
|
PATHS
|
2016-04-08 09:14:08 +01:00
|
|
|
$ENV{GMP_ROOT}
|
|
|
|
$ENV{GMP_ROOT}/lib
|
|
|
|
${GMP_ROOT}
|
|
|
|
${GMP_ROOT}/lib
|
|
|
|
${CMAKE_SOURCE_DIR}/../tools/mpir/lib
|
|
|
|
${CMAKE_SOURCE_DIR}/../tools/mpird/lib
|
|
|
|
${CMAKE_SOURCE_DIR}/../mpir/lib
|
|
|
|
${CMAKE_SOURCE_DIR}/../mpird/lib
|
2017-07-25 01:10:44 +01:00
|
|
|
|
|
|
|
$ENV{PROGRAMFILES}/mpir/lib
|
2016-04-08 09:14:08 +01:00
|
|
|
$ENV{PROGRAMFILES}/mpird/lib
|
|
|
|
$ENV{HOME}/mpir/lib
|
|
|
|
$ENV{HOME}/mpird/lib
|
|
|
|
${CMAKE_INSTALL_PREFIX}/lib
|
|
|
|
DOC "Try first the MPIR DLL when in an Windows environment"
|
|
|
|
)
|
|
|
|
|
|
|
|
get_filename_component(GMP_LIBRARIES_DIR "${GMP_LIBRARIES}" PATH)
|
2016-04-05 02:19:31 +01:00
|
|
|
|
2016-04-08 09:14:08 +01:00
|
|
|
find_file(GMP_LIBRARY_DLL NAMES mpir.dll mpird.dll
|
|
|
|
PATHS
|
|
|
|
${GMP_LIBRARIES_DIR}/../bin
|
|
|
|
${GMP_LIBRARIES_DIR}
|
2016-04-05 02:19:31 +01:00
|
|
|
)
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2016-05-30 11:23:36 +01:00
|
|
|
find_path(GMP_INCLUDE_DIRS
|
2016-04-08 09:14:08 +01:00
|
|
|
NAMES mpir.h mpird.h
|
|
|
|
PATHS
|
|
|
|
${GMP_LIBRARIES_DIR}/../include
|
|
|
|
${GMP_LIBRARIES_DIR}
|
|
|
|
)
|
|
|
|
|
2017-11-11 22:48:09 +00:00
|
|
|
else()
|
2016-04-05 02:19:31 +01:00
|
|
|
|
2016-04-08 09:14:08 +01:00
|
|
|
#use GMP, notice that there are two cases, everything is the same directory, or everything is in
|
|
|
|
#its proper places
|
|
|
|
|
2016-05-30 11:23:36 +01:00
|
|
|
|
2017-11-11 22:48:09 +00:00
|
|
|
|
2017-10-11 02:24:15 +01:00
|
|
|
find_library(GMP_LIBRARIES
|
|
|
|
NAMES gmp libgmp
|
|
|
|
HINTS
|
2016-05-30 11:23:36 +01:00
|
|
|
.
|
2016-04-08 09:14:08 +01:00
|
|
|
$ENV{GMP_ROOT}
|
|
|
|
$ENV{GMP_ROOT}/lib
|
2017-10-11 02:24:15 +01:00
|
|
|
${GMP_ROOT}
|
|
|
|
${GMP_ROOT}/lib
|
2016-04-08 09:14:08 +01:00
|
|
|
/usr/local/opt/gmp/lib
|
|
|
|
/opt/lib
|
|
|
|
/usr/local/lib
|
|
|
|
$ENV{HOME}/lib
|
|
|
|
${CMAKE_INSTALL_PREFIX}/lib
|
2016-02-28 19:32:55 +00:00
|
|
|
)
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2017-10-11 02:24:15 +01:00
|
|
|
|
|
|
|
find_path(GMP_INCLUDE_DIRS
|
|
|
|
NAMES gmp.h
|
|
|
|
HINTS
|
|
|
|
.
|
|
|
|
$ENV{GMP_ROOT}
|
|
|
|
$ENV{GMP_ROOT}/include
|
|
|
|
${GMP_ROOT}
|
|
|
|
${GMP_ROOT}/include
|
|
|
|
${GMP_LIBRARIES_DIR}/../include
|
|
|
|
${GMP_LIBRARIES_DIR}
|
|
|
|
)
|
2017-11-21 15:44:43 +00:00
|
|
|
endif()
|
2017-10-11 02:24:15 +01:00
|
|
|
|
2016-04-05 02:19:31 +01:00
|
|
|
get_filename_component(GMP_LIBRARIES_DIR "${GMP_LIBRARIES}" PATH CACHE)
|
2014-12-04 07:59:30 +00:00
|
|
|
|
2016-04-08 09:14:08 +01:00
|
|
|
|
2016-02-28 19:32:55 +00:00
|
|
|
# handle the QUIET and REQUIRED arguments and set GMP_FOUND to TRUE if
|
|
|
|
# all listed variables are true
|
|
|
|
include(FindPackageHandleStandardArgs)
|
2016-04-10 14:21:17 +01:00
|
|
|
if(MSVC)
|
2017-11-11 22:48:09 +00:00
|
|
|
find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARIES GMP_LIBRARIES_DIR GMP_LIBRARY_DLL GMP_INCLUDE_DIRS)
|
|
|
|
mark_as_advanced(GMP_LIBRARY_DLL)
|
2016-02-28 19:32:55 +00:00
|
|
|
else()
|
2017-11-11 22:48:09 +00:00
|
|
|
find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARIES GMP_LIBRARIES_DIR GMP_INCLUDE_DIRS)
|
2016-02-28 19:32:55 +00:00
|
|
|
endif()
|
2016-04-05 02:19:31 +01:00
|
|
|
|
2017-11-11 22:48:09 +00:00
|
|
|
|
2016-04-05 02:19:31 +01:00
|
|
|
mark_as_advanced(GMP_LIBRARIES GMP_LIBRARIES_DIR GMP_INCLUDE_DIRS)
|
2017-11-11 22:48:09 +00:00
|
|
|
|
|
|
|
|