Integrate nlohmann_json into CMake

Better integration into base/json.cpp

Signed-off-by: Alexander A. Klimov <alexander.klimov@icinga.com>
This commit is contained in:
Michael Friedrich 2018-10-18 15:22:50 +02:00 committed by Alexander A. Klimov
parent 89b371813f
commit 724b34c6f2
3 changed files with 14 additions and 0 deletions

View File

@ -153,6 +153,10 @@ else()
list(APPEND base_DEPS ${YAJL_LIBRARIES}) list(APPEND base_DEPS ${YAJL_LIBRARIES})
endif() endif()
# JSON
find_package(JSON)
include_directories(${JSON_INCLUDE})
find_package(Editline) find_package(Editline)
set(HAVE_EDITLINE "${EDITLINE_FOUND}") set(HAVE_EDITLINE "${EDITLINE_FOUND}")

9
cmake/FindJSON.cmake Normal file
View File

@ -0,0 +1,9 @@
FIND_PATH (JSON_INCLUDE json.hpp HINTS "${PROJECT_SOURCE_DIR}/third-party/nlohmann_json")
if (JSON_INCLUDE)
set(JSON_BuildTests OFF CACHE INTERNAL "")
message(STATUS "Found JSON: ${JSON_INCLUDE}" )
else ()
message(FATAL_ERROR "Unable to include json.hpp")
endif ()

View File

@ -11,6 +11,7 @@
#include <yajl/yajl_version.h> #include <yajl/yajl_version.h>
#include <yajl/yajl_gen.h> #include <yajl/yajl_gen.h>
#include <yajl/yajl_parse.h> #include <yajl/yajl_parse.h>
#include <json.hpp>
#include <stack> #include <stack>
using namespace icinga; using namespace icinga;