I downloaded webview and added this cmakelists file:
cmake_minimum_required(VERSION 3.17)
project(webview)
set(CMAKE_CXX_STANDARD 17)
include_directories(script/microsoft.web.webview2.1.0.664.37/build/native/include)
add_library(webview SHARED IMPORTED)
set_target_properties(webview PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/dll/x64/webview.dll"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/dll/x64/webview.lib" # not sure if this path is correct
LINKER_LANGUAGE C
)
add_library(WebView2Loader SHARED IMPORTED)
set_target_properties(WebView2Loader PROPERTIES
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/dll/x64/WebView2Loader.dll"
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/dll/x64/WebView2Loader.lib" # not sure if this path is correct
LINKER_LANGUAGE C
)
add_executable(webview_test main.cc)
target_link_libraries(webview_test PRIVATE webview WebView2Loader)
which results in this error:
====================[ Build | webviewt | Debug ]================================
cmake.exe --build webview\cmake-build-debug --target webview_test
Scanning dependencies of target webview_test
[ 50%] Building CXX object CMakeFiles/webview_test.dir/main.cc.obj
main.cc
NMAKE : fatal error U1073: don't know how to make 'webview-NOTFOUND'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Does anyone know what the actual issue is here?
I'm trying to build the basic demo provided with the webview dll.
I've played around with various configs, and it either says it doesn't know how to make library, or it can't find a non-existent webview.lib
.
I spoke to someone who said you need a lib in order to link with cmake - however there's no provided lib. Would I have to generate my own?
usually you say:
Heres the headers for the code and heres the static lib for linking while compiling the executable
I would think for a DLL itd be:
Here's the headers for the code and btw don't link anything its loaded at runtime
So why is a .lib
necessary? All the knowledge I need is available in the headers - and everything links at runtime.