0002-CMakeLists-txt-add-BUILD_OPENCV-option.patch 1.2 KB

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