blob: 33ac483123392767d3e89fcc53077fccf28c7e23 [file] [log] [blame]
Andrew Geissler7f40b712020-05-15 14:09:53 -05001From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@intel.com>
3Date: Thu, 9 Jan 2020 16:24:24 +0000
4Subject: [PATCH] opencv: abort configure if we need to download
5
Brad Bishope42b3e32020-01-15 22:08:42 -05006This CMake module will download files during do_configure. This is bad as it
7means we can't do offline builds.
8
9Add an option to disallow downloads by emitting a fatal error.
10
11Upstream-Status: Pending
12Signed-off-by: Ross Burton <ross.burton@intel.com>
13
Andrew Geissler7f40b712020-05-15 14:09:53 -050014---
15 cmake/OpenCVDownload.cmake | 6 ++++++
16 1 file changed, 6 insertions(+)
17
Brad Bishope42b3e32020-01-15 22:08:42 -050018diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake
Andrew Geissler7f40b712020-05-15 14:09:53 -050019index 63cf6d3238..4acf477f70 100644
Brad Bishope42b3e32020-01-15 22:08:42 -050020--- a/cmake/OpenCVDownload.cmake
21+++ b/cmake/OpenCVDownload.cmake
22@@ -14,6 +14,7 @@
23 # RELATIVE_URL - if set, then URL is treated as a base, and FILENAME will be appended to it
24 # Note: uses OPENCV_DOWNLOAD_PATH folder as cache, default is <opencv>/.cache
25
26+set(OPENCV_ALLOW_DOWNLOADS ON CACHE BOOL "Allow downloads")
27 set(HELP_OPENCV_DOWNLOAD_PATH "Cache directory for downloaded files")
28 if(DEFINED ENV{OPENCV_DOWNLOAD_PATH})
29 set(OPENCV_DOWNLOAD_PATH "$ENV{OPENCV_DOWNLOAD_PATH}" CACHE PATH "${HELP_OPENCV_DOWNLOAD_PATH}")
Andrew Geissler7f40b712020-05-15 14:09:53 -050030@@ -156,6 +157,11 @@ function(ocv_download)
Brad Bishope42b3e32020-01-15 22:08:42 -050031
32 # Download
33 if(NOT EXISTS "${CACHE_CANDIDATE}")
34+ if(NOT OPENCV_ALLOW_DOWNLOADS)
35+ message(FATAL_ERROR "Not going to download ${DL_FILENAME}")
36+ return()
37+ endif()
38+
39 ocv_download_log("#cmake_download \"${CACHE_CANDIDATE}\" \"${DL_URL}\"")
Andrew Geissler7f40b712020-05-15 14:09:53 -050040 foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST})
41 ocv_download_log("#try ${try}")