Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Fedora paths #292

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions cmake/Modules/FindJSONC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,43 @@
# JSONC_INCLUDE_DIR - The JSON-C include directory.
# JSONC_LIBRARY - The JSON-C library to link against.

FIND_PATH(JSONC_INCLUDE_DIR_FEDORA json-c/json.h)
FIND_LIBRARY(JSONC_LIBRARY_FEDORA NAMES json-c)

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)
IF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA)
SET(JSONC_FOUND_FEDORA TRUE)
add_definitions(-DJSONC_FEDORA)
ENDIF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA)

IF (JSONC_FOUND OR JSONC_FOUND_FEDORA)
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)

ENDIF (JSONC_FOUND)

IF (JSONC_FOUND_FEDORA)
# show which JSON-C was found only if not quiet
IF (NOT JSONC_FIND_QUIETLY)
MESSAGE(STATUS "Found JSON-C: ${JSONC_LIBRARY_FEDORA}")
ENDIF (NOT JSONC_FIND_QUIETLY)

# 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)
ENDIF (JSONC_FOUND_FEDORA)

ELSE (JSONC_FOUND)
ELSE (JSONC_FOUND OR JSONC_FOUND_FEDORA)

# 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)
# 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)
ENDIF(JSONC_FOUND OR JSONC_FOUND_FEDORA)
4 changes: 4 additions & 0 deletions libgrive/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ find_package(CppUnit)
find_package(Iberty)
find_package(ZLIB)

if (JSONC_FOUND_FEDORA)
set( JSONC_LIBRARY ${JSONC_LIBRARY_FEDORA} )
ENDIF (JSONC_FOUND_FEDORA)

# additional headers if build unit tests
IF ( CPPUNIT_FOUND )
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
Expand Down
5 changes: 5 additions & 0 deletions libgrive/src/protocol/Json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@
#pragma warning(push)
#pragma warning(disable: 4005)
#endif
#ifdef JSONC_FEDORA
#include <json-c/json_tokener.h>
#include <json-c/linkhash.h>
#else
#include <json/json_tokener.h>
#include <json/linkhash.h>
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
Expand Down