appveyor: add support for using custom CMake versions

To allow more flexibility and not be limited by defaults offered by
the runner machines:
- Visual Studio 2013: CMake 3.12.2
- Visual Studio 2015, 2017: CMake 3.16.2
Ref: https://www.appveyor.com/docs/windows-images-software/

Start using 3.18.4, 3.19.8, 3.20.6 in older VS jobs to add variations.

Time cost is a couple of seconds per job.

Ref: #18704 (Discussion)
Ref: #16973

Closes #19737
This commit is contained in:
Viktor Szakats 2025-11-27 23:23:18 +01:00
parent 376c7bddc4
commit c9e50e9e39
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
2 changed files with 20 additions and 0 deletions

View file

@ -42,6 +42,23 @@ elif [ "${APPVEYOR_BUILD_WORKER_IMAGE}" = 'Visual Studio 2019' ]; then
fi
if [ "${BUILD_SYSTEM}" = 'CMake' ]; then
# Install custom cmake version
if [ -n "${CMAKE_VERSION:-}" ]; then
cmake_ver=$(printf '%02d%02d' \
"$(echo "$CMAKE_VERSION" | cut -f1 -d.)" \
"$(echo "$CMAKE_VERSION" | cut -f2 -d.)")
if [ "${cmake_ver}" -ge '0320' ]; then
fn="cmake-${CMAKE_VERSION}-windows-x86_64"
else
fn="cmake-${CMAKE_VERSION}-win64-x64"
fi
curl --disable --fail --silent --show-error --connect-timeout 15 --max-time 60 --retry 3 --retry-connrefused \
--location "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${fn}.zip" --output bin.zip
7z x -y bin.zip >/dev/null
rm -f bin.zip
PATH="$PWD/${fn}/bin:$PATH"
fi
# Set env CHKPREFILL to the value '_chkprefill' to compare feature detection
# results with and without the pre-fill feature. They have to match.
for _chkprefill in '' ${CHKPREFILL:-}; do