diff options
author | Mathias Preiner <mathias.preiner@gmail.com> | 2018-08-29 08:20:31 -0700 |
---|---|---|
committer | Mathias Preiner <mathias.preiner@gmail.com> | 2018-09-22 16:30:59 -0700 |
commit | 8f311f52037a9fb6a82d062342fec4b5396173c6 (patch) | |
tree | d20966972af4872d7b30dca1de41c1fc55f2decf /cmake/FindGMP.cmake | |
parent | 7be6be7dec00579cb7eaae32bed1217d6c35ee83 (diff) |
cmake: Add options for specifying install directories for dependencies.
Diffstat (limited to 'cmake/FindGMP.cmake')
-rw-r--r-- | cmake/FindGMP.cmake | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake index 2d7b9b64a..a835e2d5e 100644 --- a/cmake/FindGMP.cmake +++ b/cmake/FindGMP.cmake @@ -3,8 +3,28 @@ # GMP_INCLUDE_DIR - the GMP include directory # GMP_LIBRARIES - Libraries needed to use GMP -find_path(GMP_INCLUDE_DIR NAMES gmp.h) -find_library(GMP_LIBRARIES NAMES gmp libgmp) + +# Check default location of GMP built with contrib/get-gmp. +# If the user provides a directory we will not search the default paths and +# fail if GMP was not found in the specified directory. +if(NOT GMP_HOME) + set(GMP_HOME ${PROJECT_SOURCE_DIR}/gmp-6.1.2) + set(CHECK_SYSTEM_VERSION TRUE) +endif() + +find_path(GMP_INCLUDE_DIR + NAMES gmp.h gmpxx.h + PATHS ${GMP_HOME}/include + NO_DEFAULT_PATH) +find_library(GMP_LIBRARIES + NAMES gmp + PATHS ${GMP_HOME}/lib + NO_DEFAULT_PATH) + +if(CHECK_SYSTEM_VERSION) + find_path(GMP_INCLUDE_DIR NAMES gmp.h gmpxx.h) + find_library(GMP_LIBRARIES NAMES gmp) +endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(GMP DEFAULT_MSG GMP_INCLUDE_DIR GMP_LIBRARIES) |