Juce with Cmake and WebView2 support

Hi,

I like the juce CMake support very much. Now I wanted to use Edge/Webview2 instead of IE on Windows, and stumbled across this:

WebView2 on Windows via JUCE_USE_WIN_WEBVIEW2 flag in juce_gui_extra is not currently supported.

Going back to the Projucer is no solution for my project, so what is the proper way of getting WebView2 to work under windows with CMake?

A step by step instruction or something like that would be really much appreciated …

I allready tried to install WebView2 with NugetManager (works and gives me a WebView2.dll in my build folder somewhere), and I tried to give this dll to juce::WindowsWebView2WebBrowserComponent(), but somehow it seems that this is not working:

WindowsWebView2WebBrowserComponent::WindowsWebView2WebBrowserComponent (bool unloadWhenHidden,
                                                                        const WebView2Preferences& preferences)
    : WebBrowserComponent (ConstructWithoutPimpl { unloadWhenHidden })
{
    browser = std::make_unique<Pimpl> (*this, preferences, true);
}

browser seems to be null and I think as a fallback still IE is used.

Best,

equinox

Ok somehow found a solution by using the content of the nuget file and bringing it into my cmake-project.

Can you please post your solution here?

I found this one, but are not able to get it running: