package/opencv3: add patch to fix CMake 4 build issue

Add a small patch to fix CMake 4 build issues. Unfortunately, while
cmake/OpenCVMinDepVersions.cmake provides a MIN_VER_CMAKE that we
could pass on the command line, cmake/OpenCVGenPkgconfig.cmake doesn't
use it, so we anyway have to patch the package.

Since opencv3 is basically unmaintained, there is no point sending
this patch upstream.

Fixes:

  https://autobuild.buildroot.net/results/cc857993920607958dd817c6a877ed9386c05738/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Thomas Petazzoni
2025-12-27 15:37:13 +01:00
committed by Julien Olivain
parent 29641d1675
commit a63acfa0a3
@@ -0,0 +1,41 @@
From 3b7311f48ef70127ddad7c7ea9c008fa6af3a9a1 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Date: Thu, 25 Dec 2025 23:11:27 +0100
Subject: [PATCH] cmake: set minimum required CMake version to 3.5
This fixes build with CMake 4.
Upstream: N/A, opencv 3.x is no longer maintained
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
cmake/OpenCVGenPkgconfig.cmake | 2 +-
cmake/OpenCVMinDepVersions.cmake | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake
index 425c0faa3b..9642a4b983 100644
--- a/cmake/OpenCVGenPkgconfig.cmake
+++ b/cmake/OpenCVGenPkgconfig.cmake
@@ -110,7 +110,7 @@ endif()
# =============================================================================
else() # DEFINED CMAKE_HELPER_SCRIPT
-cmake_minimum_required(VERSION 2.8.12.2)
+cmake_minimum_required(VERSION 3.5)
cmake_policy(SET CMP0012 NEW)
include("${CMAKE_HELPER_SCRIPT}")
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVUtils.cmake")
diff --git a/cmake/OpenCVMinDepVersions.cmake b/cmake/OpenCVMinDepVersions.cmake
index e67856bb97..eb7a6d861e 100644
--- a/cmake/OpenCVMinDepVersions.cmake
+++ b/cmake/OpenCVMinDepVersions.cmake
@@ -1,5 +1,5 @@
if(NOT DEFINED MIN_VER_CMAKE)
- set(MIN_VER_CMAKE 2.8.12.2)
+ set(MIN_VER_CMAKE 3.5)
endif()
set(MIN_VER_CUDA 6.5)
set(MIN_VER_PYTHON2 2.7)
--
2.52.0