use pkg-config also for finding json-c (fixes paths on debian)

pull/40/head
Vitaliy Filippov 2015-05-14 01:20:35 +03:00
parent c0c89c306c
commit f16f212281
3 changed files with 5 additions and 34 deletions

View File

@ -1,30 +0,0 @@
# - Find JSON-C
# This module finds an installed JSON-C package.
#
# It sets the following variables:
# JSONC_FOUND - Set to false, or undefined, if JSON-C isn't found.
# JSONC_INCLUDE_DIR - The JSON-C include directory.
# JSONC_LIBRARY - The JSON-C library to link against.
FIND_PATH(JSONC_INCLUDE_DIR json/json.h)
FIND_LIBRARY(JSONC_LIBRARY NAMES json)
IF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY)
SET(JSONC_FOUND TRUE)
ENDIF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY)
IF (JSONC_FOUND)
# show which JSON-C was found only if not quiet
IF (NOT JSONC_FIND_QUIETLY)
MESSAGE(STATUS "Found JSON-C: ${JSONC_LIBRARY}")
ENDIF (NOT JSONC_FIND_QUIETLY)
ELSE (JSONC_FOUND)
# fatal error if JSON-C is required but not found
IF (JSONC_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find JSON-C")
ENDIF (JSONC_FIND_REQUIRED)
ENDIF (JSONC_FOUND)

View File

@ -3,7 +3,6 @@ project(libgrive)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
find_package(LibGcrypt REQUIRED)
find_package(JSONC REQUIRED)
find_package(CURL REQUIRED)
find_package(EXPAT REQUIRED)
find_package(Boost 1.40.0 COMPONENTS program_options filesystem unit_test_framework system REQUIRED)
@ -13,6 +12,7 @@ find_package(Iberty)
find_package(ZLIB)
find_package(PkgConfig)
pkg_check_modules(JSONC REQUIRED json-c)
pkg_check_modules(YAJL REQUIRED yajl)
# additional headers if build unit tests
@ -45,6 +45,7 @@ include_directories(
${libgrive_SOURCE_DIR}/test
${GDBM_INCLUDE_DIR}
${OPT_INCS}
${JSONC_INCLUDE_DIRS}
${YAJL_INCLUDE_DIRS}
)
@ -86,7 +87,7 @@ add_library( grive STATIC ${LIBGRIVE_SRC} ${OPT_SRC} )
target_link_libraries( grive
${YAJL_LIBRARIES}
${CURL_LIBRARIES}
${JSONC_LIBRARY}
${JSONC_LIBRARIES}
${LIBGCRYPT_LIBRARIES}
${GDBM_LIBRARIES}
${Boost_LIBRARIES}

View File

@ -29,8 +29,8 @@
#pragma warning(push)
#pragma warning(disable: 4005)
#endif
#include <json/json_tokener.h>
#include <json/linkhash.h>
#include <json_tokener.h>
#include <linkhash.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif