aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-support/opencv/opencv/download.patch
blob: 33ac483123392767d3e89fcc53077fccf28c7e23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 9 Jan 2020 16:24:24 +0000
Subject: [PATCH] opencv: abort configure if we need to download

This CMake module will download files during do_configure.  This is bad as it
means we can't do offline builds.

Add an option to disallow downloads by emitting a fatal error.

Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 cmake/OpenCVDownload.cmake | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
index 63cf6d3238..4acf477f70 100644
--- a/cmake/OpenCVDownload.cmake
+++ b/cmake/OpenCVDownload.cmake
@@ -14,6 +14,7 @@
 #    RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it
 #  Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache
 
+set(OPENCV_ALLOW_DOWNLOADS ON CACHE BOOL "Allow downloads")
 set(HELP_OPENCV_DOWNLOAD_PATH "Cache directory for downloaded files")
 if(DEFINED ENV{OPENCV_DOWNLOAD_PATH})
   set(OPENCV_DOWNLOAD_PATH "$ENV{OPENCV_DOWNLOAD_PATH}" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}")
@@ -156,6 +157,11 @@ function(ocv_download)
 
   # Download
   if(NOT EXISTS "${CACHE_CANDIDATE}")
+    if(NOT OPENCV_ALLOW_DOWNLOADS)
+      message(FATAL_ERROR "Not going to download ${DL_FILENAME}")
+      return()
+    endif()
+
     ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"")
     foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST})
       ocv_download_log("#try ${try}")