Enable web view support only by default if Qt WebEngine is present
The web view is only an optional enhancement in my applications so having the support disabled is rather common. So for a better out-of-the-box experience when configuring my projects it makes sense not having to disable web view support explicitly if Qt WebEngine is not installed anyways.
This commit is contained in:
parent
defecc45bc
commit
96f10766d4
|
@ -66,10 +66,6 @@ if (IMPORTED_KF_MODULES)
|
|||
endif ()
|
||||
|
||||
# find and use the required Qt/KF modules
|
||||
set(QT_PACKAGE_PREFIX
|
||||
"Qt5"
|
||||
CACHE STRING "specifies the prefix for Qt packages")
|
||||
string(TOLOWER "${QT_PACKAGE_PREFIX}" QT_PACKAGE_PREFIX_LOWER)
|
||||
set(QT_LINGUIST_TOOLS_PACKAGE "${QT_PACKAGE_PREFIX}LinguistTools")
|
||||
set(QT_QMAKE_TARGET "${QT_PACKAGE_PREFIX}::qmake")
|
||||
foreach (MODULE ${QT_MODULES})
|
||||
|
@ -79,9 +75,6 @@ foreach (MODULE ${QT_MODULES})
|
|||
endif ()
|
||||
use_qt_module(PREFIX "${QT_PACKAGE_PREFIX}" MODULE "${MODULE}" ${MODULE_OPTIONS})
|
||||
endforeach ()
|
||||
set(KF_PACKAGE_PREFIX
|
||||
"KF5"
|
||||
CACHE STRING "specifies the prefix for KDE Frameworks packages")
|
||||
foreach (MODULE ${KF_MODULES})
|
||||
unset(MODULE_OPTIONS)
|
||||
if ("${MODULE}" IN_LIST META_PUBLIC_KF_MODULES)
|
||||
|
@ -329,6 +322,7 @@ option(BUILTIN_TRANSLATIONS_OF_QT "enables/disables built-in translations of Qt
|
|||
"${BUILTIN_TRANSLATIONS}")
|
||||
|
||||
# determine relevant Qt translation files
|
||||
string(TOLOWER "${QT_PACKAGE_PREFIX}" QT_PACKAGE_PREFIX_LOWER)
|
||||
set(QT_TRANSLATION_FILES)
|
||||
set(QT_TRANSLATION_SEARCH_PATHS)
|
||||
query_qmake_variable_path(QT_INSTALL_TRANSLATIONS)
|
||||
|
|
|
@ -11,6 +11,14 @@ set(QT_LINKAGE_DETERMINED ON)
|
|||
# include validate_visibility from c++utilities' 3rdParty module
|
||||
include(3rdParty)
|
||||
|
||||
# allow switching the Qt and KDE Frameworks version
|
||||
set(QT_PACKAGE_PREFIX
|
||||
"Qt5"
|
||||
CACHE STRING "specifies the prefix for Qt packages")
|
||||
set(KF_PACKAGE_PREFIX
|
||||
"KF5"
|
||||
CACHE STRING "specifies the prefix for KDE Frameworks packages")
|
||||
|
||||
# determine the minimum Qt version
|
||||
if (NOT META_QT_VERSION)
|
||||
if (META_QT5_VERSION)
|
||||
|
|
|
@ -6,9 +6,19 @@ if (TARGET_CONFIG_DONE)
|
|||
message(FATAL_ERROR "Can not include QtWebViewProviderConfig module when targets are already configured.")
|
||||
endif ()
|
||||
|
||||
# include required modules
|
||||
include(QtLinkage)
|
||||
|
||||
# check whether Qt WebEngine is present
|
||||
find_package("${QT_PACKAGE_PREFIX}WebEngineWidgets" "${META_QT_VERSION}")
|
||||
set(WEBVIEW_PROVIDER_DEFAULT "none")
|
||||
if ("${${QT_PACKAGE_PREFIX}WebEngineWidgets_FOUND}")
|
||||
set(WEBVIEW_PROVIDER_DEFAULT "webengine")
|
||||
endif ()
|
||||
|
||||
# configure the specified web view provider
|
||||
set(WEBVIEW_PROVIDER
|
||||
"webengine"
|
||||
"${WEBVIEW_PROVIDER_DEFAULT}"
|
||||
CACHE STRING "specifies the web view provider: webengine (default), webkit or none")
|
||||
if (WEBVIEW_PROVIDER STREQUAL "webkit")
|
||||
set(WEBVIEW_PROVIDER WebKitWidgets)
|
||||
|
|
Loading…
Reference in New Issue