Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 1 | From b18a280fab06a680d9f831bf8b462647f3cb6214 Mon Sep 17 00:00:00 2001 |
| 2 | From: Ross Burton <ross.burton@intel.com> |
| 3 | Date: Thu, 9 Jan 2020 16:24:24 +0000 |
| 4 | Subject: [PATCH] opencv: abort configure if we need to download |
| 5 | |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 6 | This CMake module will download files during do_configure. This is bad as it |
| 7 | means we can't do offline builds. |
| 8 | |
| 9 | Add an option to disallow downloads by emitting a fatal error. |
| 10 | |
| 11 | Upstream-Status: Pending |
| 12 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 13 | |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 14 | --- |
| 15 | cmake/OpenCVDownload.cmake | 6 ++++++ |
| 16 | 1 file changed, 6 insertions(+) |
| 17 | |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 18 | diff --git a/cmake/OpenCVDownload.cmake b/cmake/OpenCVDownload.cmake |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 19 | index 63cf6d3238..4acf477f70 100644 |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 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}") |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 30 | @@ -156,6 +157,11 @@ function(ocv_download) |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 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}\"") |
Andrew Geissler | 7f40b71 | 2020-05-15 14:09:53 -0500 | [diff] [blame] | 40 | foreach(try ${OPENCV_DOWNLOAD_TRIES_LIST}) |
| 41 | ocv_download_log("#try ${try}") |