[cmake-user] Update old CMake to 3.16 (#42203)

This commit is contained in:
Kai Pastor 2024-11-19 07:49:57 +01:00 committed by GitHub
parent 2a8dc1b6d9
commit acd031980f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 54 deletions

View file

@ -4,38 +4,48 @@ set(cmake_commands "")
if("cmake-current" IN_LIST FEATURES)
list(APPEND cmake_commands "${CMAKE_COMMAND}")
endif()
if("cmake-3-7" IN_LIST FEATURES)
set(cmake_version 3.7.2)
if("cmake-3-16" IN_LIST FEATURES)
# For convenient updates, use
# vcpkg install ... --cmake-args=-DVCPKG_CMAKE_USER_UPDATE=1
set(cmake_version 3.16.3)
set(legacy_cmake_archive NOTFOUND)
string(REGEX REPLACE "([^.]*[.][^.]*).*" "\\1" cmake_major_minor "${cmake_version}")
if(VCPKG_HOST_IS_WINDOWS)
set(name "cmake-${cmake_version}-win32-x86")
if(VCPKG_HOST_IS_WINDOWS OR VCPKG_CMAKE_USER_UPDATE)
set(name "cmake-${cmake_version}-win64-x64")
vcpkg_download_distfile(legacy_cmake_archive
FILENAME "${name}.zip"
URLS "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${name}.zip"
"https://cmake.org/files/v${cmake_major_minor}/${name}.zip"
SHA512 c359a22e2e688da1513db195280d6e8987bc8d570a0c543f1b1dfc8572fe4fd6c23d951ec5d5eae640fcca3bef3ae469083511474796ade8c6319d8bc4e4b38d
SHA512 724d22f3736f0f3503ceb6b49ebec64cd569c4c16ad4fae8ac38918b09ee67e3eaa8072e30546f14f4c13bb94c5639ec940ea1b4695c94225b2a597bb4da1ede
)
set(cmake_bin_dir "/bin")
elseif(VCPKG_HOST_IS_OSX)
endif()
if(VCPKG_HOST_IS_OSX OR VCPKG_CMAKE_USER_UPDATE)
set(name "cmake-${cmake_version}-Darwin-x86_64")
vcpkg_download_distfile(legacy_cmake_archive
FILENAME "${name}.tar.gz"
URLS "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${name}.tar.gz"
"https://cmake.org/files/v${cmake_major_minor}/${name}.tar.gz"
SHA512 8e41608f4dd998020acf2bd1b0dab4aec37b3ea9e228f2c4a457cd1c0339d94db38a0548b4b07a9e3605f9beb11a3f6737a72813586c4ad5f730d74038a14c2b
SHA512 3e59e2406f4e088b60922fbf23e92e1be3bb34c00f919625210fd93c059b5e6785afa40d3a501f36b281cde29de592f2ccffade6fa3980d0cf31dc845483184f
)
set(cmake_bin_dir "/CMake.app/Contents/bin")
elseif(VCPKG_HOST_IS_LINUX)
endif()
if(VCPKG_HOST_IS_LINUX OR VCPKG_CMAKE_USER_UPDATE)
set(name "cmake-${cmake_version}-Linux-x86_64")
vcpkg_download_distfile(legacy_cmake_archive
FILENAME "${name}.tar.gz"
URLS "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${name}.tar.gz"
"https://cmake.org/files/v${cmake_major_minor}/${name}.tar.gz"
SHA512 459909fcfb9c74993c3d4ab9db4e31ea940515b670db44d039de611d813099895e695467cc8da24824315486e38e2f3e246aa92d6236c51103822ec8a39e3168
SHA512 03be16ad06fcabe40a36d0a510fdb58f5612108aed70cef7f68879d82b9e04ad62a9d0c30f3406df618ec219c74fc27b4be533d970bc60ac22333951d6cabe1a
)
set(cmake_bin_dir "/bin")
else()
message(FATAL_ERROR "Unable to test feature 'cmake-3-7' for '${HOST_TRIPLET}' host.")
endif()
if(NOT legacy_cmake_archive)
message(FATAL_ERROR "Unable to test feature 'cmake-3-16' for '${HOST_TRIPLET}' host.")
endif()
if(VCPKG_CMAKE_USER_UPDATE)
message(STATUS "All downloads are up-to-date.")
message(FATAL_ERROR "Stopping due to VCPKG_CMAKE_USER_UPDATE being enabled.")
endif()
vcpkg_extract_source_archive(legacy_cmake
@ -46,11 +56,7 @@ if("cmake-3-7" IN_LIST FEATURES)
list(APPEND cmake_commands "${legacy_cmake}${cmake_bin_dir}/cmake")
endif()
if(DEFINED ENV{VCPKG_FORCE_SYSTEM_BINARIES})
set(NINJA "ninja")
else()
vcpkg_find_acquire_program(NINJA)
endif()
function(get_packages out_packages cmake_version)
set(packages "")

View file

@ -1,36 +1,20 @@
{
"name": "cmake-user",
"version-date": "2022-11-12",
"version-string": "ci",
"description": "Test port to verify the vcpkg toolchain in cmake user projects",
"license": "MIT",
"default-features": [
"ci"
],
"features": {
"ci": {
"description": "The CI set of features to test",
"dependencies": [
{
"name": "cmake-user",
"default-features": false,
"features": [
"name": "cmake-3-16",
"platform": "x64 & (windows | linux | osx) & !uwp"
},
"cmake-current",
"find-package",
"pkg-check-modules"
]
},
{
"name": "cmake-user",
"default-features": false,
"features": [
"cmake-3-7"
],
"platform": "x64 & (windows | linux | osx) & !uwp"
}
]
},
"cmake-3-7": {
"description": "Run the tests with CMake 3.7"
"features": {
"cmake-3-16": {
"description": "Run the tests with CMake 3.16"
},
"cmake-current": {
"description": "Run the tests with vcpkg's current version of CMake"
@ -58,14 +42,11 @@
},
{
"$package": "Fontconfig",
"$since": "3.14",
"name": "fontconfig",
"platform": "!mingw & !uwp"
},
{
"$comment": "CMake 3.13 for debug postfix support",
"$package": "GLUT",
"$since": "3.13",
"name": "freeglut",
"platform": "!uwp & !osx"
},
@ -75,9 +56,7 @@
"default-features": false
},
{
"$comment": "CMake 3.9 for find_dependency forwarding extra arguments",
"$package": "GDAL",
"$since": "3.9",
"name": "gdal",
"default-features": false,
"platform": "!uwp"
@ -107,7 +86,6 @@
},
{
"$package": "Iconv",
"$since": "3.11",
"name": "libiconv"
},
{
@ -129,16 +107,12 @@
"platform": "!uwp & !mingw"
},
{
"$comment": "CMake 3.11 because it needs Iconv",
"$package": "LibXml2",
"$since": "3.11",
"name": "libxml2",
"default-features": false
},
{
"$comment": "CMake 3.11 because it needs Iconv",
"$package": "LibXslt",
"$since": "3.11",
"name": "libxslt",
"default-features": false,
"platform": "!uwp & !mingw"
@ -159,7 +133,6 @@
},
{
"$package": "SQLite3",
"$since": "3.14",
"name": "sqlite3",
"default-features": false
},