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)
19 find_path(LZ4_INCLUDE_DIR
21 HINTS "${LZ4_INCLUDEDIR}" "${LZ4_HINTS}/include"
27 find_library(LZ4_LIBRARY
29 HINTS "${LZ4_LIBDIR}" "${LZ4_HINTS}/lib"
35 include(FindPackageHandleStandardArgs)
36 find_package_handle_standard_args( LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR )
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()
51 set ( LZ4_DLL_DIR "${LZ4_HINTS}/bin"
52 CACHE PATH "Path to LZ4 DLL"
54 file( GLOB _lz4_dll RELATIVE "${LZ4_DLL_DIR}"
55 "${LZ4_DLL_DIR}/lz4*.dll"
57 set ( LZ4_DLL ${_lz4_dll}
58 # We're storing filenames only. Should we use STRING instead?
59 CACHE FILEPATH "LZ4 DLL file name"
61 file( GLOB _lz4_pdb RELATIVE "${LZ4_DLL_DIR}"
62 "${LZ4_DLL_DIR}/lz4*.pdb"
64 set ( LZ4_PDB ${_lz4_pdb}
65 CACHE FILEPATH "LZ4 PDB file name"
67 mark_as_advanced( LZ4_DLL_DIR LZ4_DLL LZ4_PDB )
70 set( LZ4_INCLUDE_DIRS )
74 mark_as_advanced( LZ4_LIBRARIES LZ4_INCLUDE_DIRS )