jsoncpp requires a C++ compiler instead of a C one. Fixes the following build error:
fatal error: cstddef: No such file or directory '#include <cstddef> Issue was discovered on the buildbots where an SDK contained a broken pkgconf. Make json-c required in order to not even attempt compilation when json-c is missing. Signed-off-by: Rosen Penev <ros...@gmail.com> --- CMakeLists.txt | 7 ++----- blobmsg_json.c | 6 +----- jshn.c | 6 +----- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a1b7d5..34a98bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,11 +15,8 @@ OPTION(BUILD_LUA "build Lua plugin" ON) OPTION(BUILD_EXAMPLES "build examples" ON) INCLUDE(FindPkgConfig) -PKG_SEARCH_MODULE(JSONC json-c) -IF(JSONC_FOUND) - ADD_DEFINITIONS(-DJSONC) - INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) -ENDIF() +PKG_SEARCH_MODULE(JSONC json-c REQUIRED) +INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c base64.c) diff --git a/blobmsg_json.c b/blobmsg_json.c index dce81e9..35bdc21 100644 --- a/blobmsg_json.c +++ b/blobmsg_json.c @@ -17,11 +17,7 @@ #include "blobmsg.h" #include "blobmsg_json.h" -#ifdef JSONC - #include <json.h> -#else - #include <json/json.h> -#endif +#include <json.h> bool blobmsg_add_object(struct blob_buf *b, json_object *obj) { diff --git a/jshn.c b/jshn.c index 1b685e5..061fc7f 100644 --- a/jshn.c +++ b/jshn.c @@ -13,11 +13,7 @@ * 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 <json.h> #include <string.h> #include <stdlib.h> -- 2.29.2 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel