-
Notifications
You must be signed in to change notification settings - Fork 1
/
FindGMPXX.cmake
58 lines (51 loc) · 1.17 KB
/
FindGMPXX.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
# - Find GMPXX
# Find the GMPXX includes and libraries
# This module defines
# GMPXX_INCLUDE_DIR, where to find gmpxx.h
# GMPXX_LIBRARY, libgmpxx.so or libgmpxx.a
# GMPXX_FOUND, If false, do not try to use GMPXX.
#
# Availbale targets:
# GMPXX::GMPXX
find_path(GMPXX_INCLUDE_DIR gmpxx.h
PATHS
ENV GMPXX_ROOT
ENV GMPXX_INCLUDE_DIR
${GMPXX_ROOT}
/usr
/usr/local
$ENV{HOME}/.local
PATH_SUFFIXES
include
)
find_library(GMPXX_LIBRARY
NAMES
gmpxx
PATHS
ENV GMPXX_ROOT
ENV GMPXX_LIB_DIR
${GMPXX_ROOT}
/usr
/usr/local
PATH_SUFFIXES
lib
)
mark_as_advanced(GMPXX_INCLUDE_DIR GMPXX_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GMPXX
REQUIRED_VARS
GMPXX_INCLUDE_DIR
GMPXX_LIBRARY
)
if (NOT TARGET GMP::GMP)
find_package(GMP REQUIRED)
endif()
if(GMPXX_FOUND AND NOT TARGET GMPXX::GMPXX)
add_library(GMPXX::GMPXX UNKNOWN IMPORTED)
set_target_properties(GMPXX::GMPXX PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${GMPXX_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GMPXX_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES GMP::GMP
)
endif()