Check for the zstd version
This commit is contained in:
parent
7e376af8fc
commit
c5c60e04dd
1 changed files with 14 additions and 0 deletions
14
externals/find-modules/Findzstd.cmake
vendored
14
externals/find-modules/Findzstd.cmake
vendored
|
@ -11,12 +11,26 @@ find_library(zstd_LIBRARY
|
||||||
PATHS ${PC_zstd_LIBRARY_DIRS}
|
PATHS ${PC_zstd_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(zstd_INCLUDE_DIR)
|
||||||
|
file(STRINGS "${zstd_INCLUDE_DIR}/zstd.h" _zstd_version_lines
|
||||||
|
REGEX "#define[ \t]+ZSTD_VERSION_(MAJOR|MINOR|RELEASE)")
|
||||||
|
string(REGEX REPLACE ".*ZSTD_VERSION_MAJOR *\([0-9]*\).*" "\\1" _zstd_version_major "${_zstd_version_lines}")
|
||||||
|
string(REGEX REPLACE ".*ZSTD_VERSION_MINOR *\([0-9]*\).*" "\\1" _zstd_version_minor "${_zstd_version_lines}")
|
||||||
|
string(REGEX REPLACE ".*ZSTD_VERSION_RELEASE *\([0-9]*\).*" "\\1" _zstd_version_release "${_zstd_version_lines}")
|
||||||
|
set(zstd_VERSION "${_zstd_version_major}.${_zstd_version_minor}.${_zstd_version_release}")
|
||||||
|
unset(_zstd_version_major)
|
||||||
|
unset(_zstd_version_minor)
|
||||||
|
unset(_zstd_version_release)
|
||||||
|
unset(_zstd_version_lines)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(zstd
|
find_package_handle_standard_args(zstd
|
||||||
FOUND_VAR zstd_FOUND
|
FOUND_VAR zstd_FOUND
|
||||||
REQUIRED_VARS
|
REQUIRED_VARS
|
||||||
zstd_LIBRARY
|
zstd_LIBRARY
|
||||||
zstd_INCLUDE_DIR
|
zstd_INCLUDE_DIR
|
||||||
|
zstd_VERSION
|
||||||
VERSION_VAR zstd_VERSION
|
VERSION_VAR zstd_VERSION
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue