From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001 From: Ross Burton 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 --- 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 /.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}")