From bc8c8f75b784fb62e2db0c28178a1e767be92021 Mon Sep 17 00:00:00 2001
From: "FeRD (Frank Dana)" <ferdnyc@gmail.com>
Date: Fri, 23 Apr 2021 21:54:26 -0400
Subject: [PATCH] Fix wechat iconv dependency

---
 modules/wechat_qrcode/CMakeLists.txt | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/wechat_qrcode/CMakeLists.txt b/modules/wechat_qrcode/CMakeLists.txt
index 210f4a0d..3d02c7bb 100644
--- a/modules/wechat_qrcode/CMakeLists.txt
+++ b/modules/wechat_qrcode/CMakeLists.txt
@@ -1,6 +1,16 @@
 set(the_description "WeChat QR code Detector")
 ocv_define_module(wechat_qrcode opencv_core opencv_imgproc opencv_dnn WRAP java objc python js)
 
+# iconv support isn't automatic on some systems
+if(CMAKE_VERSION VERSION_GREATER 3.11)
+  find_package(Iconv QUIET)
+  if(Iconv_FOUND)
+    ocv_target_link_libraries(${the_module} Iconv::Iconv)
+  else()
+    ocv_target_compile_definitions(${the_module} PRIVATE "NO_ICONV=1")
+  endif()
+endif()
+
 # need to change
 set(wechat_qrcode_commit_hash "a8b69ccc738421293254aec5ddb38bd523503252")
 set(hash_detect_caffemodel "238e2b2d6f3c18d6c3a30de0c31e23cf")
-- 
2.30.2

