]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/cmake/Findlz4.cmake
import quincy beta 17.1.0
[ceph.git] / ceph / src / seastar / cmake / Findlz4.cmake
1 #
2 # This file is open source software, licensed to you under the terms
3 # of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 # distributed with this work for additional information regarding copyright
5 # ownership. You may not use this file except in compliance with the License.
6 #
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17 #
18
19 #
20 # Copyright (C) 2018 Scylladb, Ltd.
21 #
22
23 find_package (PkgConfig REQUIRED)
24
25 pkg_search_module (lz4_PC liblz4)
26
27 find_library (lz4_LIBRARY
28 NAMES lz4
29 HINTS
30 ${lz4_PC_LIBDIR}
31 ${lz4_PC_LIBRARY_DIRS})
32
33 find_path (lz4_INCLUDE_DIR
34 NAMES lz4.h
35 HINTS
36 ${lz4_PC_INCLUDEDIR}
37 ${lz4_PC_INCLUDEDIRS})
38
39 mark_as_advanced (
40 lz4_LIBRARY
41 lz4_INCLUDE_DIR)
42
43 include (FindPackageHandleStandardArgs)
44
45 find_package_handle_standard_args (lz4
46 REQUIRED_VARS
47 lz4_LIBRARY
48 lz4_INCLUDE_DIR
49 VERSION_VAR lz4_PC_VERSION)
50
51 set (lz4_LIBRARIES ${lz4_LIBRARY})
52 set (lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
53
54 if (lz4_FOUND)
55 set (CMAKE_REQUIRED_LIBRARIES ${lz4_LIBRARY})
56 include (CheckSymbolExists)
57
58 check_symbol_exists (LZ4_compress_default
59 ${lz4_INCLUDE_DIR}/lz4.h
60 lz4_HAVE_COMPRESS_DEFAULT)
61 endif ()
62
63 if (lz4_FOUND AND NOT (TARGET lz4::lz4))
64 add_library (lz4::lz4 UNKNOWN IMPORTED)
65
66 set_target_properties (lz4::lz4
67 PROPERTIES
68 IMPORTED_LOCATION ${lz4_LIBRARY}
69 INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS})
70 endif ()