mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
cmake: detect lz4 version, require >= 1.6
This commit is contained in:
parent
182bf9b333
commit
60d565e66a
2 changed files with 11 additions and 3 deletions
|
@ -1,9 +1,17 @@
|
|||
find_path(LZ4_INCLUDE_DIRS NAMES lz4.h)
|
||||
find_library(LZ4_LIBRARIES NAMES lz4)
|
||||
|
||||
if(LZ4_INCLUDE_DIRS AND EXISTS "${LZ4_INCLUDE_DIRS}/lz4.h")
|
||||
file(STRINGS "${LZ4_INCLUDE_DIRS}/lz4.h" LZ4_H REGEX "^#define LZ4_VERSION_[MR]")
|
||||
string(REGEX REPLACE "LZ4_VERSION" "" LZ4_H "${LZ4_H}")
|
||||
string(REGEX MATCHALL "[0-9]+" LZ4_H "${LZ4_H}")
|
||||
string(REGEX REPLACE ";" "." LZ4_VERSION_STRING "${LZ4_H}")
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
|
||||
LZ4 DEFAULT_MSG
|
||||
LZ4_LIBRARIES LZ4_INCLUDE_DIRS)
|
||||
LZ4
|
||||
REQUIRED_VARS LZ4_LIBRARIES LZ4_INCLUDE_DIRS
|
||||
VERSION_VAR LZ4_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(LZ4_INCLUDE_DIRS LZ4_LIBRARIES)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FIND_PACKAGE(LZ4)
|
||||
FIND_PACKAGE(LZ4 1.6)
|
||||
|
||||
IF (LZ4_FOUND)
|
||||
GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
|
||||
|
|
Loading…
Reference in a new issue