File: FindLZ4.cmake

package info (click to toggle)
kodi-vfs-libarchive 2.0.1%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 184 kB
  • sloc: cpp: 473; makefile: 10
file content (42 lines) | stat: -rw-r--r-- 1,093 bytes parent folder | download | duplicates (3)
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
40
41
42
#.rst:
# FindLZ4
# --------
# Finds the LZ4 library
#
# This will will define the following variables::
#
# LZ4_FOUND - system has lz4
# LZ4_INCLUDE_DIRS - the lz4 include directory
# LZ4_LIBRARIES - the lz4 libraries
#
# and the following imported targets::
#
#   LZ4::LZ4- The LZ4 library

if(PKG_CONFIG_FOUND)
  pkg_check_modules(PC_LZ4 liblz4 QUIET)
endif()

find_path(LZ4_INCLUDE_DIR NAMES lz4.h
                           PATHS ${PC_LZ4_INCLUDEDIR})
find_library(LZ4_LIBRARY NAMES lz4
                          PATHS ${PC_LZ4_LIBDIR})

set(LZ4_VERSION ${PC_LZ4_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LZ4
                                  REQUIRED_VARS LZ4_LIBRARY LZ4_INCLUDE_DIR
                                  VERSION_VAR LZ4_VERSION)

if(LZ4_FOUND)
  set(LZ4_LIBRARIES ${LZ4_LIBRARY})

  if(NOT TARGET LZ4::LZ4)
    add_library(LZ4::LZ4 UNKNOWN IMPORTED)
    set_target_properties(LZ4::LZ4 PROPERTIES
                                   IMPORTED_LOCATION "${LZ4_LIBRARY}")
  endif()
endif()

mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)