From b9cb7d4fe37a2103b02f276dc448f26e07654407 Mon Sep 17 00:00:00 2001 From: attila Date: Tue, 28 May 2024 18:51:21 +0200 Subject: [PATCH] Make WebView2 installation instructions more robust --- examples/CMakeLists.txt | 12 ++---------- extras/Build/CMake/FindWebView2.cmake | 6 ++++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 9f9f99863a..d3b56ce17f 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -58,20 +58,12 @@ function(_juce_add_pips) list(APPEND CMAKE_MODULE_PATH "${JUCE_CMAKE_UTILS_DIR}") endif() - find_package(WebView2 QUIET) + find_package(WebView2) if(NOT WebView2_FOUND) list(REMOVE_ITEM headers "${CMAKE_CURRENT_SOURCE_DIR}/WebViewPluginDemo.h") - message(WARNING "The WebViewPluginDemo was not enabled because WebView2 wasn't found" - " in the the local NuGet folder" - "\n" - "To install NuGet and the WebView2 package containing the statically linked library, " - "open a PowerShell and issue the following commands" - "\n" - "> Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2\n" - "> Install-Package NuGet.CommandLine -Scope CurrentUser\n" - "> Install-Package Microsoft.Web.WebView2 -Scope CurrentUser -RequiredVersion 1.0.1901.177\n") + message(WARNING "The WebViewPluginDemo was not enabled because the WebView2 package wasn't found.") endif() endif() diff --git a/extras/Build/CMake/FindWebView2.cmake b/extras/Build/CMake/FindWebView2.cmake index 41ba5c99cb..348e96a489 100644 --- a/extras/Build/CMake/FindWebView2.cmake +++ b/extras/Build/CMake/FindWebView2.cmake @@ -71,8 +71,10 @@ elseif(NOT WebView2_FIND_QUIETLY) "open a PowerShell and issue the following commands" "\n" "> Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2\n" - "> Install-Package NuGet.CommandLine -Scope CurrentUser\n" - "> Install-Package Microsoft.Web.WebView2 -Scope CurrentUser -RequiredVersion 1.0.1901.177\n") + "> Install-Package Microsoft.Web.WebView2 -Scope CurrentUser -RequiredVersion 1.0.1901.177 -Source nugetRepository\n" + "\n" + "Alternatively you can use the JUCE_WEBVIEW2_PACKAGE_LOCATION CMake variable to specify the directory " + "where this find script is looking for the *Microsoft.Web.WebView2* package directory.") endif() find_package_handle_standard_args(WebView2 DEFAULT_MSG WebView2_include_dir WebView2_library)