-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathFindLZ4.cmake
39 lines (34 loc) · 988 Bytes
/
FindLZ4.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Finds liblz4.
#
# This module defines:
# LZ4_FOUND
# LZ4_INCLUDE_DIR
# LZ4_LIBRARY
#
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
find_library(LZ4_LIBRARY NAMES lz4)
# We require LZ4_compress_default() which was added in v1.7.0
if (LZ4_LIBRARY)
include(CheckCSourceRuns)
set(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${LZ4_LIBRARY})
check_c_source_runs("
#include <lz4.h>
int main() {
int good = (LZ4_VERSION_MAJOR > 1) ||
((LZ4_VERSION_MAJOR == 1) && (LZ4_VERSION_MINOR >= 7));
return !good;
}" LZ4_GOOD_VERSION)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR LZ4_GOOD_VERSION)
if (NOT LZ4_FOUND)
message(STATUS "Using third-party bundled LZ4")
else()
message(STATUS "Found LZ4: ${LZ4_LIBRARY}")
endif (NOT LZ4_FOUND)
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)