1From 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 6This 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 14--- 15 cmake/OpenCVDownload.cmake | 6 ++++++ 16 1 file changed, 6 insertions(+) 17 18diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake 19index 63cf6d3238..4acf477f70 100644 20--- 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}") 30@@ -156,6 +157,11 @@ function(ocv_download) 31 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}\"") 40 foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST}) 41 ocv_download_log("#try ${try}") 42