From 04b5a1f098f348c4c438ada85ee86f5a9abce2ff Mon Sep 17 00:00:00 2001 From: KatieFrogs <23621460+KatieFrogs@users.noreply.github.com> Date: Fri, 4 Feb 2022 06:29:15 +0300 Subject: [PATCH] Cmake: Fix Celt not downloading Falls back to downloading through Git if it downloads an empty file --- cmake/FetchDependency.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmake/FetchDependency.cmake b/cmake/FetchDependency.cmake index 19f6a33f..3435e54f 100644 --- a/cmake/FetchDependency.cmake +++ b/cmake/FetchDependency.cmake @@ -31,6 +31,7 @@ function(FetchDependency name) if(NOT ARGS_FETCH_PRIORITY) set(ARGS_FETCH_PRIORITY git svn file) endif() + list(APPEND ARGS_FETCH_PRIORITY none) set(${name}_BIN ${VGM_BINARY_DIR}/dependencies/${ARGS_DIR}) set(${name}_BIN ${${name}_BIN} PARENT_SCOPE) @@ -92,6 +93,11 @@ function(FetchDependency name) ${ARGS_FILE_DOWNLOAD} ${${name}_PATH}/${FILE} ) + file(SIZE ${${name}_PATH}/${FILE} FILE_SIZE) + if(FILE_SIZE EQUAL 0) + message("The download of ${ARGS_DIR} (file) failed") + continue() + endif() file(ARCHIVE_EXTRACT INPUT ${${name}_PATH}/${FILE} DESTINATION ${${name}_PATH} @@ -101,6 +107,9 @@ function(FetchDependency name) set(${name}_PATH ${${name}_PATH}/${ARGS_FILE_SUBDIR} PARENT_SCOPE) endif() break() + elseif(CURRENT_FETCH STREQUAL "none") + set(${name}_PATH "" PARENT_SCOPE) + set(USE_${name} OFF PARENT_SCOPE) endif() endforeach() else()