Skip to content

Commit 1ebd873

Browse files
committed
Added macro for checking for GMP.
1 parent c5addcc commit 1ebd873

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

CMakeLists.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
11
CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
2+
3+
PROJECT( MATH )
4+
25
SET( CMAKE_COLOR_MAKEFILE ON )
36
SET( CMAKE_VERBOSE_MAKEFILE OFF )
47
SET( CMAKE_INCLUDE_CURRENT_DIR TRUE )
58
SET( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )
69

10+
SET( CMAKE_MODULE_PATH
11+
${CMAKE_MODULE_PATH}
12+
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
13+
)
14+
715
IF( NOT CMAKE_BUILD_TYPE )
816
SET( CMAKE_BUILD_TYPE Debug )
917
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG" )
1018
ENDIF( )
1119

12-
PROJECT( MATH )
13-
1420
# Versioning.
1521
SET( ${PROJECT_NAME}_MAJOR_VERSION 0 )
1622
SET( ${PROJECT_NAME}_MINOR_VERSION 1 )
1723
SET( ${PROJECT_NAME}_PATCH_LEVEL 0 )
1824

1925
OPTION( BUILD_TESTS "Set to ON to build test programs" OFF )
2026

27+
FIND_PACKAGE( GMP REQUIRED )
28+
2129
ADD_DEFINITIONS( "-Wall" )
2230
ADD_SUBDIRECTORY( src )
2331

cmake/FindGMP.cmake

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Try to find the GMP libraries
2+
# GMP_FOUND - system has GMP lib
3+
# GMP_INCLUDE_DIR - the GMP include directory
4+
# GMP_LIBRARIES - Libraries needed to use GMP
5+
6+
# Copyright (c) 2006, Laurent Montel, <[email protected]>
7+
#
8+
# Redistribution and use is allowed according to the terms of the BSD license.
9+
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
10+
11+
if (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
12+
# Already in cache, be silent
13+
set(GMP_FIND_QUIETLY TRUE)
14+
endif (GMP_INCLUDE_DIR AND GMP_LIBRARIES)
15+
16+
find_path(GMP_INCLUDE_DIR NAMES gmp.h )
17+
find_library(GMP_LIBRARIES NAMES gmp libgmp )
18+
find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx )
19+
#MESSAGE(STATUS "GMP libs: " ${GMP_LIBRARIES} " " ${GMPXX_LIBRARIES} )
20+
21+
include(FindPackageHandleStandardArgs)
22+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES)
23+
24+
mark_as_advanced(GMP_INCLUDE_DIR GMP_LIBRARIES)

0 commit comments

Comments
 (0)