1# Copyright (c) Facebook, Inc. and its affiliates.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15#
16# - Try to find Facebook zstd library
17# This will define
18# ZSTD_FOUND
19# ZSTD_INCLUDE_DIR
20# ZSTD_LIBRARY
21#
22
23find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
24
25find_library(ZSTD_LIBRARY_DEBUG NAMES zstdd zstd_staticd)
26find_library(ZSTD_LIBRARY_RELEASE NAMES zstd zstd_static)
27
28include(SelectLibraryConfigurations)
29SELECT_LIBRARY_CONFIGURATIONS(ZSTD)
30
31include(FindPackageHandleStandardArgs)
32FIND_PACKAGE_HANDLE_STANDARD_ARGS(
33    ZSTD DEFAULT_MSG
34    ZSTD_LIBRARY ZSTD_INCLUDE_DIR
35)
36
37if (ZSTD_FOUND)
38    message(STATUS "Found Zstd: ${ZSTD_LIBRARY}")
39endif()
40
41mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
42