diff --git a/CMakeLists.txt b/CMakeLists.txt index 3556d3a96..9c5a4f469 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,10 @@ else() list(APPEND base_DEPS ${YAJL_LIBRARIES}) endif() +# JSON +find_package(JSON) +include_directories(${JSON_INCLUDE}) + find_package(Editline) set(HAVE_EDITLINE "${EDITLINE_FOUND}") diff --git a/cmake/FindJSON.cmake b/cmake/FindJSON.cmake new file mode 100644 index 000000000..b7d5d79d2 --- /dev/null +++ b/cmake/FindJSON.cmake @@ -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 () diff --git a/lib/base/json.cpp b/lib/base/json.cpp index a9a1e5f56..13cb143f8 100644 --- a/lib/base/json.cpp +++ b/lib/base/json.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include using namespace icinga;