]> git.cworth.org Git - apitrace/blob - cmake/FindSnappy.cmake
Automatically detect whether trace is zlib or snappy compressed
[apitrace] / cmake / FindSnappy.cmake
1 # - Try to find Snappy
2 # Once done this will define
3 #  SNAPPY_FOUND - System has Snappy
4 #  SNAPPY_INCLUDE_DIRS - The Snappy include directories
5 #  SNAPPY_LIBRARIES - The libraries needed to use Snappy
6 #  SNAPPY_DEFINITIONS - Compiler switches required for using Snappy
7
8 find_package(PkgConfig)
9 pkg_check_modules(PC_SNAPPY QUIET snappy)
10 set(SNAPPY_DEFINITIONS ${PC_SNAPPY_CFLAGS_OTHER})
11
12 find_path(SNAPPY_INCLUDE_DIR snappy.h
13           HINTS ${PC_SNAPPY_INCLUDEDIR} ${PC_SNAPPY_INCLUDE_DIRS}
14           PATH_SUFFIXES snappy )
15
16 find_library(SNAPPY_LIBRARY NAMES snappy libsnappy
17              HINTS ${PC_SNAPPY_LIBDIR} ${PC_SNAPPY_LIBRARY_DIRS} )
18
19 set(SNAPPY_LIBRARIES ${SNAPPY_LIBRARY} )
20 set(SNAPPY_INCLUDE_DIRS ${SNAPPY_INCLUDE_DIR} )
21
22 include(FindPackageHandleStandardArgs)
23 # handle the QUIETLY and REQUIRED arguments and set SNAPPY_FOUND to TRUE
24 # if all listed variables are TRUE
25 find_package_handle_standard_args(snappy  DEFAULT_MSG
26                                   SNAPPY_LIBRARY SNAPPY_INCLUDE_DIR)
27
28 mark_as_advanced(SNAPPY_INCLUDE_DIR SNAPPY_LIBRARY )