From 183dbcb3d371bf7cd9210aa901707cd4fc491f70 Mon Sep 17 00:00:00 2001 From: Ellis Kenyo Date: Wed, 31 Dec 2014 18:49:20 +0000 Subject: [PATCH 1/3] Added Fedora paths --- cmake/Modules/FindJSONC.cmake | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmake/Modules/FindJSONC.cmake b/cmake/Modules/FindJSONC.cmake index f72e8ea1..735a7df9 100644 --- a/cmake/Modules/FindJSONC.cmake +++ b/cmake/Modules/FindJSONC.cmake @@ -6,6 +6,9 @@ # 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) @@ -13,6 +16,10 @@ IF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY) SET(JSONC_FOUND TRUE) ENDIF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY) +IF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA) + SET(JSONC_FOUND TRUE) +ENDIF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA) + IF (JSONC_FOUND) # show which JSON-C was found only if not quiet From f7f02a8eeaed89cb1381a5aebcf9c0b3de6cf710 Mon Sep 17 00:00:00 2001 From: Ellis Kenyo Date: Wed, 31 Dec 2014 19:01:50 +0000 Subject: [PATCH 2/3] Added Fedora check --- cmake/Modules/FindJSONC.cmake | 1 + libgrive/src/protocol/Json.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cmake/Modules/FindJSONC.cmake b/cmake/Modules/FindJSONC.cmake index 735a7df9..62476b3f 100644 --- a/cmake/Modules/FindJSONC.cmake +++ b/cmake/Modules/FindJSONC.cmake @@ -18,6 +18,7 @@ ENDIF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY) IF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA) SET(JSONC_FOUND TRUE) + add_definitions(-DJSONC_FEDORA) ENDIF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA) IF (JSONC_FOUND) diff --git a/libgrive/src/protocol/Json.cc b/libgrive/src/protocol/Json.cc index 4c115d6a..e4993c5f 100644 --- a/libgrive/src/protocol/Json.cc +++ b/libgrive/src/protocol/Json.cc @@ -29,8 +29,13 @@ #pragma warning(push) #pragma warning(disable: 4005) #endif +#ifdef JSONC_FEDORA +#include +#include +#else #include #include +#endif #ifdef _MSC_VER #pragma warning(pop) #endif From f3a2ae9165dce80cfb95b8f166a372042c5f01a9 Mon Sep 17 00:00:00 2001 From: Ellis Kenyo Date: Wed, 31 Dec 2014 19:37:05 +0000 Subject: [PATCH 3/3] Fixed CMakeLists --- cmake/Modules/FindJSONC.cmake | 34 ++++++++++++++++++++++------------ libgrive/CMakeLists.txt | 4 ++++ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/cmake/Modules/FindJSONC.cmake b/cmake/Modules/FindJSONC.cmake index 62476b3f..7b96bccf 100644 --- a/cmake/Modules/FindJSONC.cmake +++ b/cmake/Modules/FindJSONC.cmake @@ -17,22 +17,32 @@ IF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY) ENDIF (JSONC_INCLUDE_DIR AND JSONC_LIBRARY) IF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA) - SET(JSONC_FOUND TRUE) + SET(JSONC_FOUND_FEDORA TRUE) add_definitions(-DJSONC_FEDORA) ENDIF (JSONC_INCLUDE_DIR_FEDORA AND JSONC_LIBRARY_FEDORA) -IF (JSONC_FOUND) +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) diff --git a/libgrive/CMakeLists.txt b/libgrive/CMakeLists.txt index 3cc15742..71f76b68 100644 --- a/libgrive/CMakeLists.txt +++ b/libgrive/CMakeLists.txt @@ -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} )