CMake: reset webview2 package dir if it does not exist anymore

And make the variable internal so it does not create an 'Ungrouped Entries' group in cmake-gui.
This commit is contained in:
Maarten Bent
2021-03-06 18:49:38 +01:00
parent 560656c699
commit 3198ed0b18

View File

@@ -44,13 +44,15 @@ elseif(WXMSW)
set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}") set(WEBVIEW2_DEFAULT_PACKAGE_DIR "${CMAKE_BINARY_DIR}/packages/Microsoft.Web.WebView2.${WEBVIEW2_VERSION}")
if(NOT EXISTS ${WEBVIEW2_PACKAGE_DIR})
unset(WEBVIEW2_PACKAGE_DIR CACHE)
endif()
find_path(WEBVIEW2_PACKAGE_DIR find_path(WEBVIEW2_PACKAGE_DIR
NAMES build/native/include/WebView2.h NAMES build/native/include/WebView2.h
PATHS PATHS
"${PROJECT_SOURCE_DIR}/3rdparty/webview2" "${PROJECT_SOURCE_DIR}/3rdparty/webview2"
${WEBVIEW2_DEFAULT_PACKAGE_DIR} ${WEBVIEW2_DEFAULT_PACKAGE_DIR}
) )
mark_as_advanced(WEBVIEW2_PACKAGE_DIR)
if (NOT WEBVIEW2_PACKAGE_DIR) if (NOT WEBVIEW2_PACKAGE_DIR)
message(STATUS "WebView2 SDK not found locally, downloading...") message(STATUS "WebView2 SDK not found locally, downloading...")
@@ -65,6 +67,7 @@ elseif(WXMSW)
WORKING_DIRECTORY ${WEBVIEW2_PACKAGE_DIR} WORKING_DIRECTORY ${WEBVIEW2_PACKAGE_DIR}
) )
endif() endif()
set(WEBVIEW2_PACKAGE_DIR ${WEBVIEW2_PACKAGE_DIR} CACHE INTERNAL "" FORCE)
wx_lib_include_directories(wxwebview PRIVATE "${WEBVIEW2_PACKAGE_DIR}/build/native/include") wx_lib_include_directories(wxwebview PRIVATE "${WEBVIEW2_PACKAGE_DIR}/build/native/include")
if(NOT MSVC) if(NOT MSVC)