From 91f99cd9cdbc6dee748fe34542d618f490097957 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Wed, 5 Jul 2023 18:15:14 +0700 Subject: [PATCH] If certificates download fails, bail out --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b3c30c850..1bcd21114b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,8 +247,12 @@ if(WITH_VCPKG) ) endforeach() - # Using file(DOWNLOAD) to use https - file(DOWNLOAD https://curl.se/ca/cacert.pem "${CMAKE_BINARY_DIR}/cacert.pem" TLS_VERIFY ON) + file(DOWNLOAD https://curl.se/ca/cacert.pem "${CMAKE_BINARY_DIR}/cacert.pem" TLS_VERIFY ON STATUS DOWNLOAD_STATUS) + list(GET DOWNLOAD_STATUS 0 STATUS_CODE) + list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE) + if(NOT ${STATUS_CODE} EQUAL 0) + message(FATAL_ERROR "Error occurred during download: ${ERROR_MESSAGE}") + endif() add_custom_command(TARGET deploy POST_BUILD