aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2019-08-27 14:49:13 +0100
committerAnders Broman <a.broman58@gmail.com>2019-08-27 15:50:40 +0000
commita1532e7b16abf9912fae50a1ac50bcc8a53149aa (patch)
tree80d0e25c148130d6f20094f9ad3d69514f117d8a /cmake
parentb3f67fa1fa40d617bdcdf4fcae694b02d00f4562 (diff)
cmake: check minimum zstd library version.
The APIs used in the kafka dissector have been introduced in version 1.0.0, then we need at least that version to work. Change-Id: I80ded2362d4f324ec26392bd7a9781ea6d9ba630 Reviewed-on: https://code.wireshark.org/review/34382 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/FindZSTD.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmake/modules/FindZSTD.cmake b/cmake/modules/FindZSTD.cmake
index d2d1f6207a..54f9281869 100644
--- a/cmake/modules/FindZSTD.cmake
+++ b/cmake/modules/FindZSTD.cmake
@@ -31,8 +31,21 @@ find_library(ZSTD_LIBRARY
/usr/local/lib
)
+file(STRINGS ${ZSTD_INCLUDE_DIR}/zstd.h ZSTD_VERSION_MAJOR
+ REGEX "#define[ ]+ZSTD_VERSION_MAJOR[ ]+[0-9]+")
+string(REGEX MATCH "[0-9]+" ZSTD_VERSION_MAJOR ${ZSTD_VERSION_MAJOR})
+file(STRINGS ${ZSTD_INCLUDE_DIR}/zstd.h ZSTD_VERSION_MINOR
+ REGEX "#define[ ]+ZSTD_VERSION_MINOR[ ]+[0-9]+")
+string(REGEX MATCH "[0-9]+" ZSTD_VERSION_MINOR ${ZSTD_VERSION_MINOR})
+file(STRINGS ${ZSTD_INCLUDE_DIR}/zstd.h ZSTD_VERSION_RELEASE
+ REGEX "#define[ ]+ZSTD_VERSION_RELEASE[ ]+[0-9]+")
+string(REGEX MATCH "[0-9]+" ZSTD_VERSION_RELEASE ${ZSTD_VERSION_RELEASE})
+set(ZSTD_VERSION ${ZSTD_VERSION_MAJOR}.${ZSTD_VERSION_MINOR}.${ZSTD_VERSION_RELEASE})
+
include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args( ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR )
+find_package_handle_standard_args(ZSTD
+ REQUIRED_VARS ZSTD_LIBRARY ZSTD_INCLUDE_DIR
+ VERSION_VAR ZSTD_VERSION)
if( ZSTD_FOUND )
set( ZSTD_INCLUDE_DIRS ${ZSTD_INCLUDE_DIR} )