add pkgconfig support for json-c
this includes a fallback for legacy support
This commit is contained in:
parent
b2010c706c
commit
49e6e062b8
3 changed files with 19 additions and 2 deletions
|
@ -12,6 +12,13 @@ IF(APPLE)
|
|||
LINK_DIRECTORIES(/opt/local/lib)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPkgConfig)
|
||||
PKG_CHECK_MODULES(JSONC json)
|
||||
IF(JSONC_FOUND)
|
||||
ADD_DEFINITIONS(-DJSONC)
|
||||
INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
|
||||
SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c)
|
||||
|
||||
ADD_LIBRARY(ubox SHARED ${SOURCES})
|
||||
|
|
|
@ -16,7 +16,12 @@
|
|||
#ifndef __BLOBMSG_JSON_H
|
||||
#define __BLOBMSG_JSON_H
|
||||
|
||||
#ifdef JSONC
|
||||
#include <json.h>
|
||||
#else
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "blobmsg.h"
|
||||
|
||||
|
|
5
jshn.c
5
jshn.c
|
@ -13,7 +13,12 @@
|
|||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef JSONC
|
||||
#include <json.h>
|
||||
#else
|
||||
#include <json/json.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
Loading…
Reference in a new issue