From 2eab5eb6c080b319674366a375c49b02497e9ea9 Mon Sep 17 00:00:00 2001
From: Roman Donchenko <roman.donchenko@itseez.com>
Date: Wed, 26 Aug 2015 13:42:21 +0300
Subject: [PATCH] Only conflict with packages corresponding to modules that are
 built

---
 cmake/OpenCVPackaging.cmake | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake
index b3943e79a..1574ffa73 100644
--- a/cmake/OpenCVPackaging.cmake
+++ b/cmake/OpenCVPackaging.cmake
@@ -112,8 +112,10 @@ set(STD_OPENCV_DEV libopencv-dev)
 
 foreach(module calib3d contrib core features2d flann gpu highgui imgproc legacy
                ml objdetect ocl photo stitching superres ts video videostab)
-  list(APPEND STD_OPENCV_LIBS "libopencv-${module}2.4")
-  list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
+  if(HAVE_opencv_${module})
+    list(APPEND STD_OPENCV_LIBS "libopencv-${module}2.4")
+    list(APPEND STD_OPENCV_DEV "libopencv-${module}-dev")
+  endif()
 endforeach()
 
 string(REPLACE ";" ", " CPACK_COMPONENT_LIBS_CONFLICTS "${STD_OPENCV_LIBS}")