From acd031980f8543af2e994fd62bd76487c52704bd Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 19 Nov 2024 07:49:57 +0100 Subject: [PATCH] [cmake-user] Update old CMake to 3.16 (#42203) --- scripts/test_ports/cmake-user/portfile.cmake | 40 ++++++++++------- scripts/test_ports/cmake-user/vcpkg.json | 47 +++++--------------- 2 files changed, 33 insertions(+), 54 deletions(-) diff --git a/scripts/test_ports/cmake-user/portfile.cmake b/scripts/test_ports/cmake-user/portfile.cmake index 3999a49d64..d5fc746976 100644 --- a/scripts/test_ports/cmake-user/portfile.cmake +++ b/scripts/test_ports/cmake-user/portfile.cmake @@ -4,40 +4,50 @@ 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 ARCHIVE "${legacy_cmake_archive}" SOURCE_BASE "${cmake_version}" @@ -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() +vcpkg_find_acquire_program(NINJA) function(get_packages out_packages cmake_version) set(packages "") diff --git a/scripts/test_ports/cmake-user/vcpkg.json b/scripts/test_ports/cmake-user/vcpkg.json index 1197b1183a..241a18bcb5 100644 --- a/scripts/test_ports/cmake-user/vcpkg.json +++ b/scripts/test_ports/cmake-user/vcpkg.json @@ -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" + { + "name": "cmake-3-16", + "platform": "x64 & (windows | linux | osx) & !uwp" + }, + "cmake-current", + "find-package", + "pkg-check-modules" ], "features": { - "ci": { - "description": "The CI set of features to test", - "dependencies": [ - { - "name": "cmake-user", - "default-features": false, - "features": [ - "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" + "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 },