1From fe740316af970f57ec511cdeafb512510e4842a9 Mon Sep 17 00:00:00 2001 2From: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3Date: Sat, 9 Nov 2019 17:21:13 +0100 4Subject: [PATCH] CMakeLists.txt: add BUILD_OPENCV option 5 6Add BUILD_OPENCV option to allow the user to disable OpenCV. It is 7especially useful as opencv library can be built without highgui support 8 9Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 10[Upstream status: https://github.com/glassechidna/zxing-cpp/pull/90] 11--- 12 CMakeLists.txt | 7 +++++-- 13 1 file changed, 5 insertions(+), 2 deletions(-) 14 15diff --git a/CMakeLists.txt b/CMakeLists.txt 16index 738f4e1..12913cd 100644 17--- a/CMakeLists.txt 18+++ b/CMakeLists.txt 19@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.0) 20 project(zxing) 21 22 option(BUILD_TESTING "Enable generation of test targets" OFF) 23+option(BUILD_OPENCV "Enable OpenCV classes and OpenCV cli executable" ON) 24 25 set(CMAKE_LIBRARY_PATH /opt/local/lib ${CMAKE_LIBRARY_PATH}) 26 27@@ -44,8 +45,10 @@ else() 28 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") 29 endif() 30 31-# OpenCV classes 32-find_package(OpenCV) 33+if (BUILD_OPENCV) 34+ # OpenCV classes 35+ find_package(OpenCV) 36+endif() 37 if(OpenCV_FOUND) 38 list(APPEND LIBZXING_FILES 39 opencv/src/zxing/MatSource.cpp 40