file(DOWNLOAD): STATUS can be a list of 3 elements instead of 2 elements
Regarding the STATUS argument, the documentation of file(DOWNLOAD) states that status is a ; separated list of length 2
. However, there is at least one literal status string (returning early; file already exists with expected MD5 hash
) that itself contains a ;
, resulting in an unexpected status list length of 3.
Tested with CMake 3.22.2.
Example:
cmake_minimum_required(VERSION 3.22...3.22 FATAL_ERROR)
project(example NONE)
set(vswhere_version 2.8.4)
set(vswhere_hash MD5=47311796bf30801f56b242524f384ff6)
macro(download)
file(DOWNLOAD
"https://github.com/microsoft/vswhere/releases/download/${vswhere_version}/vswhere.exe"
"${CMAKE_CURRENT_BINARY_DIR}/vswhere.exe"
EXPECTED_HASH ${vswhere_hash}
STATUS status
)
list(LENGTH status length)
message(STATUS "Status [${status}] is a list of ${length} element(s)")
endmacro()
download()
download()
Example output on first configure:
Status [0;"No error"] is a list of 2 element(s)
Status [0;"returning early; file already exists with expected MD5 hash"] is a list of 3 element(s)