[PATCH 1/2] jsonfilter: drop legacy json-c support

Sergey Ponomarev stokito at gmail.com
Tue Jan 19 02:14:16 EST 2021


The cmake logic is wrong (E.G. PKG_CHECK_FOR_MODULES fails unless all modules are found), and the legacy libjson.so name is also used by the other libjson (http://sourceforge.net/projects/libjson/) which provides an incompatible API, so just drop it.

Backported from libubox cbf80de7f4df61960f386cb01a899cf4228d38f3

Signed-off-by: Sergey Ponomarev <stokito at gmail.com>
---
 CMakeLists.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7361eb2..dbfbf5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,14 +7,12 @@ IF(NOT APPLE)
   SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,--gc-sections")
 ENDIF()
 
-find_library(json NAMES json-c json)
-
 IF(DEBUG)
   ADD_DEFINITIONS(-DDEBUG -g3)
 ENDIF()
 
 INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(JSONC json-c json)
+PKG_CHECK_MODULES(JSONC json-c)
 IF(JSONC_FOUND)
   ADD_DEFINITIONS(-DJSONC)
   INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
@@ -40,6 +38,7 @@ INCLUDE_DIRECTORIES(${ubox_include_dir})
 SET_PROPERTY(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "lemon;parser.h;parser.out")
 SET_SOURCE_FILES_PROPERTIES("parser.c" PROPERTIES GENERATED TRUE)
 ADD_EXECUTABLE(jsonpath main.c ast.c lexer.c parser.c matcher.c)
+find_library(json NAMES json-c)
 TARGET_LINK_LIBRARIES(jsonpath ubox ${json})
 
 INSTALL(TARGETS jsonpath RUNTIME DESTINATION bin)
-- 
2.27.0




More information about the openwrt-devel mailing list