Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorFelix Geyer <debfx@fobos.de>2014-01-12 16:42:19 +0400
committerFelix Geyer <debfx@fobos.de>2014-01-12 16:42:19 +0400
commiteee909e9485435e0d4423c90174e9dd195742764 (patch)
treeb8027cf77d3415e792272d516b3f9b53efb0d1b1 /cmake
parent8c7e6552742d11b13bc381fb39c00f9d57ce70ba (diff)
Parse the libgcrypt version in the cmake module.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindGcrypt.cmake12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmake/FindGcrypt.cmake b/cmake/FindGcrypt.cmake
index 90303003c..077570462 100644
--- a/cmake/FindGcrypt.cmake
+++ b/cmake/FindGcrypt.cmake
@@ -17,7 +17,15 @@ find_path(GCRYPT_INCLUDE_DIR gcrypt.h)
find_library(GCRYPT_LIBRARIES gcrypt)
+mark_as_advanced(GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
+
+if(GCRYPT_INCLUDE_DIR AND EXISTS "${GCRYPT_INCLUDE_DIR}/gcrypt.h")
+ file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_H REGEX "^#define GCRYPT_VERSION \"[^\"]*\"$")
+ string(REGEX REPLACE "^.*GCRYPT_VERSION \"([0-9]+).*$" "\\1" GCRYPT_VERSION_MAJOR "${GCRYPT_H}")
+ string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_MINOR "${GCRYPT_H}")
+ string(REGEX REPLACE "^.*GCRYPT_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" GCRYPT_VERSION_PATCH "${GCRYPT_H}")
+ set(GCRYPT_VERSION_STRING "${GCRYPT_VERSION_MAJOR}.${GCRYPT_VERSION_MINOR}.${GCRYPT_VERSION_PATCH}")
+endif()
+
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gcrypt DEFAULT_MSG GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
-
-mark_as_advanced(GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)