From: =?utf-8?b?IkFuZHJldyBMZWUgKOadjuWBpeeniyki?= <ajqlee@debian.org>
Date: Thu, 7 Aug 2025 19:05:35 -0300
Subject: Find jsoncpp lib

Origin: Debian
Forwarded: not-needed
Reviewed-By: Andrew Lee (李健秋) <ajqlee@debian.org>
Last-Update: 2019-08-19

---
 src/CMakeLists.txt | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c8255ef..edd97bc 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -100,7 +100,18 @@ if(USE_CUSTOM_LIBCXX)
 endif()
 
 if(USE_SYSTEM_JSONCPP)
-	list(APPEND EXTRA_LIBS jsoncpp)
+	find_package(PkgConfig)
+	if(PKG_CONFIG_FOUND)
+	  pkg_check_modules (JSONCPP jsoncpp)
+	endif()
+
+	if(NOT JSONCPP_FOUND)
+	  find_path(JSONCPP_INCLUDE_DIRS json/json.h
+	            PATH_SUFFIXES jsoncpp)
+	  find_library(JSONCPP_LIBRARIES jsoncpp)
+	endif()
+	include_directories(${JSONCPP_INCLUDE_DIRS})
+	list(APPEND EXTRA_LIBS ${JSONCPP_LIBRARIES})
 endif()
 
 target_link_libraries(${LIBNAME} ${EXTRA_LIBS} ${CMAKE_DL_LIBS})
