qtutilities/cmake/modules/WebViewProviderConfig.cmake
Martchus 9cf5656efe reduce code duplication in build system
- get rid of qmake project file
- provide CMake modules for common tasks
- provide templates for *.desktop files
2016-04-16 02:11:20 +02:00

36 lines
1.6 KiB
CMake

# determines the web view provider (either Qt WebKit or Qt WebEngine)
set(WEBVIEW_PROVIDER "auto" CACHE STRING "specifies the web view provider: auto (default), webkit, webengine or none")
if(${WEBVIEW_PROVIDER} STREQUAL "auto")
find_package(Qt5WebKitWidgets)
if(Qt5WebKitWidgets_FOUND)
set(WEBVIEW_PROVIDER Qt5::WebKitWidgets)
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBKIT")
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebKit.")
else()
find_package(Qt5WebEngineWidgets REQUIRED)
set(WEBVIEW_PROVIDER Qt5::WebEngineWidgets)
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBENGINE")
message(STATUS "No web view provider explicitly specified, defaulting to Qt WebEngine.")
endif()
else()
if(${WEBVIEW_PROVIDER} STREQUAL "webkit")
find_package(Qt5WebKitWidgets REQUIRED)
set(WEBVIEW_PROVIDER Qt5::WebKitWidgets)
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBKIT")
message(STATUS "Using Qt WebKit as webview provider.")
elseif(${WEBVIEW_PROVIDER} STREQUAL "webengine")
find_package(Qt5WebEngineWidgets REQUIRED)
set(WEBVIEW_PROVIDER Qt5::WebEngineWidgets)
set(JS_DEFINITION "-D${META_PROJECT_NAME}USE_WEBENGINE")
message(STATUS "Using Qt WebEngine as webview provider.")
elseif(${WEBVIEW_PROVIDER} STREQUAL "none")
set(JS_DEFINITION "-D${META_PROJECT_NAME}NO_WEBVIEW")
message(STATUS "Webview has been disabled.")
else()
message(FATAL_ERROR "The specified web view provider '${WEBVIEW_PROVIDER}' is unknown.")
endif()
endif()
list(APPEND LIBRARIES ${WEBVIEW_PROVIDER})