]> git.proxmox.com Git - ceph.git/blob - ceph/cmake/modules/Findsnappy.cmake
import 15.2.9
[ceph.git] / ceph / cmake / modules / Findsnappy.cmake
1 # - Find Snappy
2 # Find the snappy compression library and includes
3 #
4 # SNAPPY_INCLUDE_DIR - where to find snappy.h, etc.
5 # SNAPPY_LIBRARIES - List of libraries when using snappy.
6 # SNAPPY_FOUND - True if snappy found.
7
8 find_package(PkgConfig QUIET REQUIRED)
9 pkg_search_module(PC_snappy
10 snappy QUIET)
11
12 find_path(SNAPPY_INCLUDE_DIR
13 NAMES snappy.h
14 HINTS
15 ${PC_snappy_INCLUDE_DIRS}
16 ${SNAPPY_ROOT_DIR}/include)
17
18 find_library(SNAPPY_LIBRARIES
19 NAMES snappy
20 HINTS
21 ${PC_snappy_LIBRARY_DIRS}
22 ${SNAPPY_ROOT_DIR}/lib)
23
24 include(FindPackageHandleStandardArgs)
25 find_package_handle_standard_args(snappy
26 DEFAULT_MSG SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR)
27
28 mark_as_advanced(
29 SNAPPY_LIBRARIES
30 SNAPPY_INCLUDE_DIR)
31
32 if(snappy_FOUND AND NOT (TARGET snappy::snappy))
33 add_library(snappy::snappy UNKNOWN IMPORTED)
34 set_target_properties(snappy::snappy PROPERTIES
35 INTERFACE_INCLUDE_DIRECTORIES "${SNAPPY_INCLUDE_DIR}"
36 IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
37 IMPORTED_LOCATION "${SNAPPY_LIBRARIES}")
38 endif()