]> git.proxmox.com Git - ceph.git/blame - ceph/src/seastar/cmake/Findlz4.cmake
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / seastar / cmake / Findlz4.cmake
CommitLineData
11fdf7f2
TL
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
23find_package (PkgConfig REQUIRED)
24
1e59de90 25pkg_search_module (PC_lz4 QUIET liblz4)
11fdf7f2
TL
26
27find_library (lz4_LIBRARY
28 NAMES lz4
29 HINTS
1e59de90
TL
30 ${PC_lz4_LIBDIR}
31 ${PC_lz4_LIBRARY_DIRS})
11fdf7f2
TL
32
33find_path (lz4_INCLUDE_DIR
34 NAMES lz4.h
35 HINTS
1e59de90
TL
36 ${PC_lz4_INCLUDEDIR}
37 ${PC_lz4_INCLUDE_DIRS})
11fdf7f2
TL
38
39mark_as_advanced (
40 lz4_LIBRARY
41 lz4_INCLUDE_DIR)
42
43include (FindPackageHandleStandardArgs)
44
45find_package_handle_standard_args (lz4
46 REQUIRED_VARS
47 lz4_LIBRARY
48 lz4_INCLUDE_DIR
1e59de90 49 VERSION_VAR lz4_VERSION)
11fdf7f2
TL
50
51if (lz4_FOUND)
52 set (CMAKE_REQUIRED_LIBRARIES ${lz4_LIBRARY})
53 include (CheckSymbolExists)
54
55 check_symbol_exists (LZ4_compress_default
56 ${lz4_INCLUDE_DIR}/lz4.h
57 lz4_HAVE_COMPRESS_DEFAULT)
11fdf7f2 58
1e59de90
TL
59 set (lz4_LIBRARIES ${lz4_LIBRARY})
60 set (lz4_INCLUDE_DIRS ${lz4_INCLUDE_DIR})
61
62 if (NOT (TARGET lz4::lz4))
63 add_library (lz4::lz4 UNKNOWN IMPORTED)
11fdf7f2 64
1e59de90
TL
65 set_target_properties (lz4::lz4
66 PROPERTIES
67 IMPORTED_LOCATION ${lz4_LIBRARY}
68 INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS})
69 endif ()
11fdf7f2 70endif ()