source: CMakeModules/FindGMP.cmake@ 12351

Last change on this file since 12351 was 10700, checked in by Michael Tänzer, 12 years ago

Merge CMake branch into trunk

File size: 3.4 KB
Line 
1# - Find gmp
2# Find the GNU Multiple Precision Arithmetic Library headers and libraries.
3#
4# GMP_INCLUDE_DIRS - where to find gmp.h etc.
5# GMPXX_INCLUDE_DIRS - where to find gmpxx.h etc.
6# GMP_LIBRARIES - List of libraries when using gmp.
7# GMPXX_LIBRARIES - List of libraries when using the C++ wrapper of gmp.
8# GMP_FOUND - True if gmp found.
9# GMPXX_FOUND - True if C++ wrapper of gmp found.
10
11
12# [License]
13# The Ariba-Underlay Copyright
14#
15# Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
16#
17# Institute of Telematics
18# UniversitÀt Karlsruhe (TH)
19# Zirkel 2, 76128 Karlsruhe
20# Germany
21#
22# Redistribution and use in source and binary forms, with or without
23# modification, are permitted provided that the following conditions are
24# met:
25#
26# 1. Redistributions of source code must retain the above copyright
27# notice, this list of conditions and the following disclaimer.
28# 2. Redistributions in binary form must reproduce the above copyright
29# notice, this list of conditions and the following disclaimer in the
30# documentation and/or other materials provided with the distribution.
31#
32# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
33# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
36# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
40# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
41# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
42# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43#
44# The views and conclusions contained in the software and documentation
45# are those of the authors and should not be interpreted as representing
46# official policies, either expressed or implied, of the Institute of
47# Telematics.
48# [License]
49
50# Look for the header files.
51find_path(GMP_INCLUDE_DIR NAMES gmp.h)
52mark_as_advanced(GMP_INCLUDE_DIR)
53
54find_path(GMPXX_INCLUDE_DIR NAMES gmpxx.h)
55mark_as_advanced(GMPXX_INCLUDE_DIR)
56
57
58# Look for the library.
59find_library(GMP_LIBRARY NAMES gmp
60 DOC "The path to the GNU Multiple Precision Arithmetic Library"
61 )
62mark_as_advanced(GMP_LIBRARY)
63
64find_library(GMPXX_LIBRARY NAMES gmpxx
65 DOC "The path to the C++ wrapper of the GNU Multiple Precision Arithmetic Library"
66 )
67mark_as_advanced(GMPXX_LIBRARY)
68
69
70# handle the QUIETLY and REQUIRED arguments and set GMP_FOUND to TRUE if
71# all listed variables are TRUE
72find_package(PackageHandleStandardArgs)
73find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARY GMP_INCLUDE_DIR)
74
75if(GMP_FOUND)
76 set(GMP_LIBRARIES "${GMP_LIBRARY}")
77 set(GMP_INCLUDE_DIRS "${GMP_INCLUDE_DIR}")
78
79 # handle GMPXX
80 if(GMPXX_LIBRARY AND GMPXX_INCLUDE_DIR)
81 set(GMPXX_FIND_QUIETLY ${GMP_FIND_QUIETLY})
82 find_package(PackageMessage)
83 find_package_message(GMPXX "Found GMPXX: ${GMPXX_LIBRARY}"
84 "[${GMPXX_LIBRARY}][${GMPXX_INCLUDE_DIR}]")
85
86 set(GMPXX_FOUND TRUE)
87 set(GMPXX_LIBRARIES "${GMP_LIBRARY}" "${GMPXX_LIBRARY}")
88 set(GMPXX_INCLUDE_DIRS "${GMP_INCLUDE_DIR}" "${GMPXX_INCLUDE_DIR}")
89 endif()
90endif(GMP_FOUND)
Note: See TracBrowser for help on using the repository browser.