summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt13
-rw-r--r--README.md2
2 files changed, 14 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6892a59..2592259e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
set(Required_CMake_Version 3.16.2)
set(Required_Boost_Version 1.72)
+set(Required_Gmp_Version 6.1.2)
set(Required_Python_Version 3.9)
set(Required_Gpgmepp_Version 1.13.1)
@@ -218,6 +219,18 @@ macro(find_req_library_and_header _header_var _header _lib_var _lib)
endmacro(find_req_library_and_header _header_var _header _lib_var _lib)
find_req_library_and_header(GMP_PATH gmp.h GMP_LIB gmp)
+if (GMP_PATH AND EXISTS "${GMP_PATH}/gmp.h")
+ file(STRINGS "${GMP_PATH}/gmp.h" gmp_header_str REGEX "^#define[\t ]+__GNU_MP_VERSION(_MINOR|_PATCHLEVEL)?[\t ]+[0-9]+")
+ string(REGEX REPLACE ".*#define __GNU_MP_VERSION[\t ]+([0-9]+).*" "\\1" GMP_VERSION_MAJOR "${gmp_header_str}")
+ string(REGEX REPLACE ".*#define __GNU_MP_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" GMP_VERSION_MINOR "${gmp_header_str}")
+ string(REGEX REPLACE ".*#define __GNU_MP_VERSION_PATCHLEVEL[\t ]+([0-9]+).*" "\\1" GMP_VERSION_PATCH "${gmp_header_str}")
+ unset(gmp_header_str)
+ set(GMP_VERSION_STRING "${GMP_VERSION_MAJOR}.${GMP_VERSION_MINOR}.${GMP_VERSION_PATCH}")
+ if ("${GMP_VERSION_STRING}" VERSION_LESS ${Required_Gmp_Version})
+ message(FATAL_ERROR "Ledger requires GMP version ${Expected_Gmp_Version} or greater, but only GMP version ${GMP_VERSION_STRING} was found")
+ endif()
+endif()
+
find_req_library_and_header(MPFR_PATH mpfr.h MPFR_LIB mpfr)
check_library_exists(edit readline "" HAVE_EDIT)
diff --git a/README.md b/README.md
index 95f700e3..c523d4de 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ Dependency | Version (or greater)
------------|---------------------
[CMake] | 3.16.2
[Boost] | 1.72
-[GMP] | 4.2.2
+[Gmp] | 6.1.2
[MPFR] | 2.4.0
[utfcpp] | 3.2.3
[gettext] | 0.17 _optional_