diff --git a/external/qt/package.cmake b/external/qt/package.cmake index fde6ead9..eecbd2eb 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -36,12 +36,42 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core5Compat OpenGL OpenGLWidgets REQUIRED) endif() -# QtWaylandScanner cmake integration from Qt 6 is used -cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF "LINUX; qt_version_6_or_greater" ON) +cmake_dependent_option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration." OFF LINUX ON) if (LINUX) if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS WaylandClient REQUIRED) + + find_package(ECM QUIET) + if (ECM_FOUND) + list(PREPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) + endif() + if (QT_VERSION_MAJOR GREATER_EQUAL 5) + find_package(QtWaylandScanner REQUIRED) + + # Imitate QtWayland's generator function by means of extra CMake modules. + function(qt_generate_wayland_protocol_client_sources target) + cmake_parse_arguments(GEN "" "" FILES ${ARGN}) + foreach(xmldef ${GEN_FILES}) + get_filename_component(base ${xmldef} NAME_WE) + ecm_add_qtwayland_client_protocol(generated PROTOCOL ${xmldef} BASENAME ${base}) + endforeach() + target_sources(${target} PRIVATE ${generated}) + target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + endfunction() + endif() + + find_package(WaylandProtocols QUIET) + if (NOT WaylandProtocols_FOUND) + set(WaylandProtocols_DATADIR ${third_party_loc}/wayland-protocols) + endif() + message(STATUS "Found WaylandProtocols: ${WaylandProtocols_DATADIR}") + + find_package(PlasmaWaylandProtocols QUIET) + if (NOT PlasmaWaylandProtocols_FOUND) + set(PLASMA_WAYLAND_PROTOCOLS_DIR ${third_party_loc}/plasma-wayland-protocols/src/protocols) + endif() + message(STATUS "Found PlasmaWaylandProtocols: ${PLASMA_WAYLAND_PROTOCOLS_DIR}") endif() if ((NOT DESKTOP_APP_USE_PACKAGED