summaryrefslogtreecommitdiffstats
path: root/cmake/FindJSON_C.cmake
blob: e31a8b94e94f366b5372edf6fbf74592da135373 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Defines the following variables:
#  JSON_C_FOUND
#  JSON_C_INCLUDE_DIR
#  JSON_C_LIBRARIES
#  JSON_C_CFLAGS_OTHER
#  JSON_C_LDFLAGS_OTHER


if(ANDROID)
  find_host_package(PkgConfig REQUIRED QUIET)
else(ANDROID)
  find_package(PkgConfig REQUIRED QUIET)
endif(ANDROID)

pkg_check_modules(_JSON_C json-c)

find_path(JSON_C_INCLUDE_DIR NAMES json-c/json.h HINTS ${_JSON_C_INCLUDE_DIRS})
find_library(JSON_C_LIBRARIES NAMES json-c HINTS ${_JSON_C_LIBRARY_DIRS})

set(JSON_C_CFLAGS_OTHER "${_JSON_C_CFLAGS_OTHER}" CACHE STRING "Additional compiler flags for json-c")
set(JSON_C_LDFLAGS_OTHER "${_JSON_C_LDFLAGS_OTHER}" CACHE STRING "Additional linker flags for json-c")

find_package_handle_standard_args(JSON_C REQUIRED_VARS JSON_C_LIBRARIES JSON_C_INCLUDE_DIR)
mark_as_advanced(JSON_C_INCLUDE_DIR JSON_C_LIBRARIES JSON_C_CFLAGS_OTHER JSON_C_LDFLAGS_OTHER)