meson: fix build with opencv=enabled and opencv4. Fixes #964
authorChristoph Reiter <reiter.christoph@gmail.com>
Sun, 5 May 2019 20:11:16 +0000 (22:11 +0200)
committerTim-Philipp Müller <tim@centricular.com>
Wed, 7 Aug 2019 22:23:10 +0000 (23:23 +0100)
Having the opencv feature enabled would lead to the opencv3 dependency
being required which failed with only opencv4 being available.

Instead don't require anything and error out at the end if the feature was enabled
but no dependency was found.

gst-libs/gst/opencv/meson.build

index 3fd472fda5659968c8dec01aca11808a52f113f7..8dc2ad99be49094a240c3db5c22c48d7d251103b 100644 (file)
@@ -9,9 +9,9 @@ opencv_headers = [
   'gstopencvvideofilter.h',
 ]
 
-opencv_dep = dependency('opencv', version : '>= 3.0.0', required : get_option('opencv'))
+opencv_dep = dependency('opencv', version : '>= 3.0.0', required : false)
 if not opencv_dep.found()
-  opencv_dep = dependency('opencv4', version : '>= 4.0.0', required : get_option('opencv'))
+  opencv_dep = dependency('opencv4', version : '>= 4.0.0', required : false)
 endif
 if opencv_dep.found()
   gstopencv = library('gstopencv-' + api_version,
@@ -30,4 +30,6 @@ if opencv_dep.found()
     dependencies : [gstvideo_dep, opencv_dep])
 
   install_headers(opencv_headers, subdir : 'gstreamer-1.0/gst/opencv')
+elif get_option('opencv').enabled()
+  error('OpenCV support enabled but required dependencies were not found.')
 endif