-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathFindGMP.cmake
58 lines (45 loc) · 1.6 KB
/
FindGMP.cmake
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
# This module defines:
# GMP_FOUND - system has GMP lib
# GMP_INCLUDE_DIR - the GMP include directory
# GMP_LIBRARIES_DIR - directory where the GMP libraries are located
# GMP_LIBRARIES - Link these to use GMP
# GMP_IN_CGAL_AUXILIARY - TRUE if the GMP found is the one distributed with CGAL in the auxiliary folder
include(FindPackageHandleStandardArgs)
if(GMP_INCLUDE_DIR)
set(GMP_in_cache TRUE)
else()
set(GMP_in_cache FALSE)
endif()
if(NOT GMP_LIBRARIES)
set(GMP_in_cache FALSE)
endif()
# Is it already configured?
if (GMP_in_cache)
set(GMP_FOUND TRUE)
else()
find_path(GMP_INCLUDE_DIR
NAMES gmp.h
HINTS ENV GMP_INC_DIR
ENV GMP_DIR
PATH_SUFFIXES include
DOC "The directory containing the GMP header files"
)
set(PREVIOUS_CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_SHARED_LIBRARY_SUFFIX}")
find_library(GMP_LIBRARIES NAMES gmp
HINTS ENV GMP_LIB_DIR
ENV GMP_DIR
PATH_SUFFIXES lib
DOC "Path to the GMP library"
)
set(CMAKE_FIND_LIBRARY_SUFFIXES "${PREVIOUS_CMAKE_FIND_LIBRARY_SUFFIXES}")
unset(PREVIOUS_CMAKE_FIND_LIBRARY_SUFFIXES)
if ( GMP_LIBRARIES )
get_filename_component(GMP_LIBRARIES_DIR ${GMP_LIBRARIES} PATH CACHE )
endif()
# Attempt to load a user-defined configuration for GMP if couldn't be found
if ( NOT GMP_INCLUDE_DIR OR NOT GMP_LIBRARIES_DIR )
include( GMPConfig OPTIONAL )
endif()
find_package_handle_standard_args(GMP "DEFAULT_MSG" GMP_LIBRARIES GMP_INCLUDE_DIR)
endif()