From f3d0978dc05d8fb7b429c96e3f1080e97b7f46d2 Mon Sep 17 00:00:00 2001
From: Jakob Olsson <Jakob Olsson>
Date: Mon, 2 Dec 2019 14:54:09 +0100
Subject: [PATCH] fix linking issues at compilations

---
 CMakeLists.txt         | 3 +--
 src/json-validator.cpp | 7 ++++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 418e8ea..7bd43ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,8 +106,7 @@ target_link_libraries(json-validator
 
 target_link_libraries(json-validator
     PUBLIC
-    ${LIBUBOX_LIBRARIES})
-
+    libubox)
 # regex with boost if gcc < 4.9 - default is std::regex
 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9.0")
diff --git a/src/json-validator.cpp b/src/json-validator.cpp
index 1020272..c6d3004 100644
--- a/src/json-validator.cpp
+++ b/src/json-validator.cpp
@@ -1,7 +1,8 @@
 #include <iostream>
 #include <iomanip>
-#include <stdbool.h>
 
+extern "C"
+{
 #include <libubox/avl.h>
 #include <libubox/avl-cmp.h>
 #include <libubox/blobmsg.h>
@@ -11,8 +12,12 @@
 #include <glob.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <regex.h>
+#include <stdbool.h>
 
 #include <json-c/json.h>
+}
+
 #include <json-schema.hpp>
 #include <regex.h>
 
-- 
GitLab