TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags
[wireshark-sm.git] / cmake / modules / FindLZ4.cmake
blob83e639d5c371980bc9c2e0cfca1bee9551ab4998
2 # - Find lz4
3 # Find LZ4 includes and library
5 #  LZ4_INCLUDE_DIRS - where to find lz4.h, etc.
6 #  LZ4_LIBRARIES    - List of libraries when using LZ4.
7 #  LZ4_FOUND        - True if LZ4 found.
8 #  LZ4_DLL_DIR      - (Windows) Path to the LZ4 DLL
9 #  LZ4_DLL          - (Windows) Name of the LZ4 DLL
11 include( FindWSWinLibs )
12 FindWSWinLibs( "lz4-.*" "LZ4_HINTS" )
14 if( NOT USE_REPOSITORY)
15   find_package(PkgConfig)
16   pkg_search_module(LZ4 lz4 liblz4)
17 endif()
19 find_path(LZ4_INCLUDE_DIR
20   NAMES lz4.h
21   HINTS "${LZ4_INCLUDEDIR}" "${LZ4_HINTS}/include"
22   PATHS
23   /usr/local/include
24   /usr/include
27 find_library(LZ4_LIBRARY
28   NAMES lz4 liblz4
29   HINTS "${LZ4_LIBDIR}" "${LZ4_HINTS}/lib"
30   PATHS
31   /usr/local/lib
32   /usr/lib
35 include(FindPackageHandleStandardArgs)
36 find_package_handle_standard_args( LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR )
38 if( LZ4_FOUND )
39   include( CheckIncludeFile )
40   include( CMakePushCheckState )
42   set( LZ4_INCLUDE_DIRS ${LZ4_INCLUDE_DIR} )
43   set( LZ4_LIBRARIES ${LZ4_LIBRARY} )
45   cmake_push_check_state()
46   set( CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIRS} )
47   check_include_file( lz4frame.h HAVE_LZ4FRAME_H )
48   cmake_pop_check_state()
50   if (WIN32)
51     set ( LZ4_DLL_DIR "${LZ4_HINTS}/bin"
52       CACHE PATH "Path to LZ4 DLL"
53     )
54     file( GLOB _lz4_dll RELATIVE "${LZ4_DLL_DIR}"
55       "${LZ4_DLL_DIR}/lz4*.dll"
56     )
57     set ( LZ4_DLL ${_lz4_dll}
58       # We're storing filenames only. Should we use STRING instead?
59       CACHE FILEPATH "LZ4 DLL file name"
60     )
61     file( GLOB _lz4_pdb RELATIVE "${LZ4_DLL_DIR}"
62       "${LZ4_DLL_DIR}/lz4*.pdb"
63     )
64     set ( LZ4_PDB ${_lz4_pdb}
65       CACHE FILEPATH "LZ4 PDB file name"
66     )
67     mark_as_advanced( LZ4_DLL_DIR LZ4_DLL LZ4_PDB )
68   endif()
69 else()
70   set( LZ4_INCLUDE_DIRS )
71   set( LZ4_LIBRARIES )
72 endif()
74 mark_as_advanced( LZ4_LIBRARIES LZ4_INCLUDE_DIRS )