aboutsummaryrefslogtreecommitdiff
path: root/ports/zxing-cpp/0002-improve-features.patch
blob: 5776c36eac36b487111914c3e04442449ba08639 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ade734..54071bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.0)
 project(zxing)
 set(CMAKE_CXX_STANDARD 11)
 option(BUILD_TESTING "Enable generation of test targets" OFF)
+option(WITH_OPENCV "Build with opencv" OFF)
+option(WITH_ICONV "Build with iconv" OFF)
 
 set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH})
 
@@ -43,8 +45,8 @@ if(WIN32)
 endif()
 
 # OpenCV classes
-find_package(OpenCV)
-if(OpenCV_FOUND)
+if(WITH_OPENCV)
+    find_package(OpenCV REQUIRED)
     list(APPEND LIBZXING_FILES
         opencv/src/zxing/MatSource.cpp
         opencv/src/zxing/MatSource.h
@@ -58,10 +60,10 @@ include_directories(core/src)
 add_library(libzxing ${LIBZXING_FILES})
 set_target_properties(libzxing PROPERTIES PREFIX "")
 
-find_package(Iconv)
-if(ICONV_FOUND)
-    include_directories(${ICONV_INCLUDE_DIR})
-    target_link_libraries(libzxing ${ICONV_LIBRARIES})
+if(WITH_ICONV)
+    find_package(Iconv REQUIRED)
+    include_directories(${Iconv_INCLUDE_DIRS})
+    target_link_libraries(libzxing ${Iconv_LIBRARIES})
 else()
     add_definitions(-DNO_ICONV=1)
 endif()