summaryrefslogtreecommitdiff
path: root/src/cmake
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-05 13:32:54 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2014-12-05 13:32:54 +0000
commit425b462d361286822ee0ed7b5fe00881ba312ea3 (patch)
treee8f641a8604418882b916573cf32c87b78d33472 /src/cmake
parent952b77f3b1e2415602d5d9ffc2fb7ff45cc3edc4 (diff)
Moved into trunk
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@341 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Diffstat (limited to 'src/cmake')
-rw-r--r--src/cmake/modules/FindGMP.cmake56
-rw-r--r--src/cmake/modules/FindGMPXX.cmake44
2 files changed, 100 insertions, 0 deletions
diff --git a/src/cmake/modules/FindGMP.cmake b/src/cmake/modules/FindGMP.cmake
new file mode 100644
index 00000000..de57646f
--- /dev/null
+++ b/src/cmake/modules/FindGMP.cmake
@@ -0,0 +1,56 @@
+# - Try to find the GMP libraries
+# 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
+
+# TODO: support MacOSX
+
+include(FindPackageHandleStandardArgs)
+#include(CGAL_GeneratorSpecificSettings)
+
+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"
+ )
+
+ find_library(GMP_LIBRARIES NAMES gmp libgmp-10
+ HINTS ENV GMP_LIB_DIR
+ ENV GMP_DIR
+ PATH_SUFFIXES lib
+ DOC "Path to the GMP library"
+ )
+
+ 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()
diff --git a/src/cmake/modules/FindGMPXX.cmake b/src/cmake/modules/FindGMPXX.cmake
new file mode 100644
index 00000000..277e4b19
--- /dev/null
+++ b/src/cmake/modules/FindGMPXX.cmake
@@ -0,0 +1,44 @@
+# - Try to find the GMPXX libraries
+# This module defines:
+# GMPXX_FOUND - system has GMPXX lib
+# GMPXX_INCLUDE_DIR - the GMPXX include directory
+# GMPXX_LIBRARIES - Libraries needed to use GMPXX
+
+# TODO: support Windows and MacOSX
+
+# GMPXX needs GMP
+
+find_package( GMP QUIET )
+
+if(GMP_FOUND)
+
+ if (GMPXX_INCLUDE_DIR AND GMPXX_LIBRARIES)
+ # Already in cache, be silent
+ set(GMPXX_FIND_QUIETLY TRUE)
+ endif()
+
+ find_path(GMPXX_INCLUDE_DIR NAMES gmpxx.h
+ HINTS ENV GMPXX_INC_DIR
+ ENV GMPXX_DIR
+ ${GMP_INCLUDE_DIR_SEARCH}
+ PATH_SUFFIXES include
+ DOC "The directory containing the GMPXX include files"
+ )
+
+ find_library(GMPXX_LIBRARIES NAMES gmpxx
+ HINTS ENV GMPXX_LIB_DIR
+ ENV GMPXX_DIR
+ ${GMP_LIBRARIES_DIR_SEARCH}
+ PATH_SUFFIXES lib
+ DOC "Path to the GMPXX library"
+ )
+
+ include(FindPackageHandleStandardArgs)
+
+ find_package_handle_standard_args(GMPXX "DEFAULT_MSG" GMPXX_LIBRARIES GMPXX_INCLUDE_DIR )
+
+else()
+
+ message( FATAL_ERROR "GMPXX needs GMP")
+
+endif()