From f16f2122818be1d23e4e7bdf306f06d5e377d500 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Thu, 14 May 2015 01:20:35 +0300 Subject: [PATCH] use pkg-config also for finding json-c (fixes paths on debian) --- cmake/Modules/FindJSONC.cmake | 30 ------------------------------ libgrive/CMakeLists.txt | 5 +++-- libgrive/src/protocol/Json.cc | 4 ++-- 3 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 cmake/Modules/FindJSONC.cmake diff --git a/cmake/Modules/FindJSONC.cmake b/cmake/Modules/FindJSONC.cmake deleted file mode 100644 index f72e8ea..0000000 --- a/cmake/Modules/FindJSONC.cmake +++ /dev/null @@ -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) diff --git a/libgrive/CMakeLists.txt b/libgrive/CMakeLists.txt index 28c3cbd..a5a3dd7 100644 --- a/libgrive/CMakeLists.txt +++ b/libgrive/CMakeLists.txt @@ -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} diff --git a/libgrive/src/protocol/Json.cc b/libgrive/src/protocol/Json.cc index 4c115d6..5abeaf2 100644 --- a/libgrive/src/protocol/Json.cc +++ b/libgrive/src/protocol/Json.cc @@ -29,8 +29,8 @@ #pragma warning(push) #pragma warning(disable: 4005) #endif -#include -#include +#include +#include #ifdef _MSC_VER #pragma warning(pop) #endif