File 0006-use-system-libcjson.patch of Package CodeLite

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebb06b718..c17ff378d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -147,6 +147,9 @@ if(NOT FLEX_FOUND)
     endif()
 endif()
 
+find_package(cJSON REQUIRED)
+include_directories(${CJSON_INCLUDE_DIRS}/cjson)
+
 set(IS_FREEBSD 0)
 if(CMAKE_SYSTEM_NAME MATCHES "^.*BSD$|DragonFly")
     set(IS_FREEBSD 1)
@@ -883,7 +886,7 @@ include_directories(submodules/dtl)
 add_subdirectory(submodules/lexilla)
 
 add_subdirectory(submodules)
-include_directories(submodules/cJSON)
+#include_directories(submodules/cJSON)
 
 add_subdirectory(sdk/wxsqlite3)
 add_subdirectory(sdk/databaselayer)
diff --git a/CodeLite/CMakeLists.txt b/CodeLite/CMakeLists.txt
index 537fea7fc..1be0962ac 100644
--- a/CodeLite/CMakeLists.txt
+++ b/CodeLite/CMakeLists.txt
@@ -94,7 +94,7 @@ target_link_libraries(
     ${GTK_LIBS}
     ${ADDITIONAL_LIBRARIES}
     ${LIBUCHARDET_LIB}
-    cJSON
+    ${CJSON_LIBRARIES}
 )
 
 if(MINGW)
diff --git a/submodules/CMakeLists.txt b/submodules/CMakeLists.txt
index dbe78c6ba..156a3d048 100644
--- a/submodules/CMakeLists.txt
+++ b/submodules/CMakeLists.txt
@@ -12,11 +12,11 @@ endif()
 # ##############################################################################
 # cJSON
 # ##############################################################################
-add_library(cJSON STATIC
-	${CMAKE_CURRENT_SOURCE_DIR}/cJSON/cJSON.c
-	${CMAKE_CURRENT_SOURCE_DIR}/cJSON/cJSON.h
-)
-target_include_directories(cJSON PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cJSON)
+#add_library(cJSON STATIC
+#	${CMAKE_CURRENT_SOURCE_DIR}/cJSON/cJSON.c
+#	${CMAKE_CURRENT_SOURCE_DIR}/cJSON/cJSON.h
+#)
+#target_include_directories(cJSON PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/cJSON)
 
 # ##############################################################################
 # For wxWidgets dependencies
Submodule submodules/wxdap contains modified content
diff --git a/submodules/wxdap/dap/cJSON.hpp b/submodules/wxdap/dap/cJSON.hpp
index e130918..610c690 100644
--- a/submodules/wxdap/dap/cJSON.hpp
+++ b/submodules/wxdap/dap/cJSON.hpp
@@ -118,10 +118,10 @@ WXDLLIMPEXP_DAP void cJSON_DeleteItemFromObject(cJsonDap* object, const char* st
 WXDLLIMPEXP_DAP void cJSON_ReplaceItemInArray(cJsonDap* array, int which, cJsonDap* newitem);
 WXDLLIMPEXP_DAP void cJSON_ReplaceItemInObject(cJsonDap* object, const char* string, cJsonDap* newitem);
 
-#define cJSON_AddNullToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
-#define cJSON_AddTrueToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
-#define cJSON_AddFalseToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
-#define cJSON_AddNumberToObject(object, name, n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
-#define cJSON_AddStringToObject(object, name, s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
+//#define cJSON_AddNullToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
+//#define cJSON_AddTrueToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
+//#define cJSON_AddFalseToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
+//#define cJSON_AddNumberToObject(object, name, n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
+//#define cJSON_AddStringToObject(object, name, s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
 }; // namespace dap
 #endif
diff --git a/wxcrafter/CMakeLists.txt b/wxcrafter/CMakeLists.txt
index ebb7dcd52..41a8c7564 100644
--- a/wxcrafter/CMakeLists.txt
+++ b/wxcrafter/CMakeLists.txt
@@ -87,7 +87,7 @@ if(UNIX OR APPLE)
     set_target_properties(wxcLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
 endif()
 
-target_link_libraries(wxcLib PUBLIC cJSON)
+target_link_libraries(wxcLib PUBLIC ${CJSON_LIBRARIES})
 
 set(RES_FILE "")
 # Define the output
openSUSE Build Service is sponsored by