From aab6be9aad1e926ca2c0950b0abb7bf3c4b9105f Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sat, 27 Jan 2024 11:44:01 +1100 Subject: ExternalProject: Catch empty REMOTE or LOCAL earlier If we are given an empty string for URL, or we have a logic error that leads to the file we download to being an empty string, we will now catch this at CMake configure time instead of whenever the download is attempted at build time. --- Modules/ExternalProject.cmake | 7 +++++++ Modules/ExternalProject/download.cmake.in | 8 -------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 77566b3..d7af1bd 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1518,6 +1518,13 @@ function(_ep_write_downloadfile_script netrc netrc_file ) + if("x${REMOTE}" STREQUAL "x") + message(FATAL_ERROR "REMOTE can't be empty") + endif() + if("x${LOCAL}" STREQUAL "x") + message(FATAL_ERROR "LOCAL can't be empty") + endif() + if(timeout) set(TIMEOUT_ARGS TIMEOUT ${timeout}) set(TIMEOUT_MSG "${timeout} seconds") diff --git a/Modules/ExternalProject/download.cmake.in b/Modules/ExternalProject/download.cmake.in index bf7f209..261f782 100644 --- a/Modules/ExternalProject/download.cmake.in +++ b/Modules/ExternalProject/download.cmake.in @@ -71,14 +71,6 @@ function(sleep_before_download attempt) execute_process(COMMAND "${CMAKE_COMMAND}" -E sleep "${sleep_seconds}") endfunction() -if("@LOCAL@" STREQUAL "") - message(FATAL_ERROR "LOCAL can't be empty") -endif() - -if("@REMOTE@" STREQUAL "") - message(FATAL_ERROR "REMOTE can't be empty") -endif() - if(EXISTS "@LOCAL@") check_file_hash(has_hash hash_is_good) if(has_hash) -- cgit v0.12