From 0d6a1481886e0d00a57126cba6e3b37c1ab90a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=88=B0=E9=98=9F=E7=9A=84=E5=81=B6=E5=83=8F-=E5=B2=9B?= =?UTF-8?q?=E9=A3=8E=E9=85=B1!?= Date: Mon, 10 Feb 2025 20:57:15 +0800 Subject: [PATCH] Download when nuget.exe not exists --- flutter_inappwebview_windows/windows/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flutter_inappwebview_windows/windows/CMakeLists.txt b/flutter_inappwebview_windows/windows/CMakeLists.txt index 666fbbe08..ff54b09d4 100644 --- a/flutter_inappwebview_windows/windows/CMakeLists.txt +++ b/flutter_inappwebview_windows/windows/CMakeLists.txt @@ -8,6 +8,7 @@ set(WIL_VERSION "1.0.231216.1") set(WEBVIEW_VERSION "1.0.2849.39") set(NLOHMANN_JSON_VERSION "3.11.2") set(CPP_WINRT_VERSION "2.0.240405.15") +include(FetchContent) message(VERBOSE "CMake system version is ${CMAKE_SYSTEM_VERSION} (using SDK ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})") @@ -23,9 +24,17 @@ cmake_policy(VERSION 3.14...3.25) # not be changed set(PLUGIN_NAME "flutter_inappwebview_windows_plugin") +FetchContent_Declare(nuget + URL "https://dist.nuget.org/win-x86-commandline/v6.0.0/nuget.exe" + URL_HASH SHA256=04eb6c4fe4213907e2773e1be1bbbd730e9a655a3c9c58387ce8d4a714a5b9e1 + DOWNLOAD_NO_EXTRACT true +) + find_program(NUGET nuget) -if(NOT NUGET) - message(NOTICE "Nuget is not installed! The flutter_inappwebview_windows plugin requires it. Check https://inappwebview.dev/docs/intro#setup-windows") +if (NOT NUGET) + message("Nuget.exe not found, trying to download or use cached version.") + FetchContent_MakeAvailable(nuget) + set(NUGET ${nuget_SOURCE_DIR}/nuget.exe) endif() add_custom_target(${PROJECT_NAME}_DEPS ALL)