1#############################################################################
2# Copyright (c) 2016 Balabit
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17#
18# As an additional exemption you are allowed to compile & link against the
19# OpenSSL libraries as published by the OpenSSL project. See the file
20# COPYING for details.
21#
22#############################################################################
23
24# Origin: https://github.com/SirCmpwn/sway/blob/master/CMake/FindJsonC.cmake
25# - Find json-c
26# Find the json-c libraries
27#
28#  This module defines the following variables:
29#     JSONC_FOUND        - True if JSONC is found
30#     JSONC_LIBRARY      - JSONC libraries
31#     JSONC_INCLUDE_DIR  - JSONC include directories
32#
33
34find_package(PkgConfig)
35pkg_check_modules(PC_JSONC QUIET JSONC)
36find_path(JSONC_INCLUDE_DIR NAMES json.h HINTS ${PC_JSONC_INCLUDE_DIRS} PATH_SUFFIXES json-c json)
37find_library(JSONC_LIBRARY  NAMES json-c HINTS ${PC_JSONC_LIBRARY_DIRS})
38
39include(FindPackageHandleStandardArgs)
40find_package_handle_standard_args(JSONC DEFAULT_MSG JSONC_LIBRARY JSONC_INCLUDE_DIR)
41mark_as_advanced(JSONC_LIBRARY JSONC_INCLUDE_DIR)
42