Submitted By:            Joe Locash <jlocash at gmail dot com>
Date:                    2025-10-25
Initial Package Version: 4.2.0
Upstream Status:         Applied
Origin:                  Upstream commit b01a0249
Description:             Fixes building libqtxdg against qt-6.10.

From b01a024921acdfd5b0e97d5fda2933c726826e99 Mon Sep 17 00:00:00 2001
From: Jimi Huotari <chiitoo@gentoo.org>
Date: Tue, 17 Jun 2025 08:52:44 +0300
Subject: [PATCH] cmake: fix build with Qt 6.10

The 'Qt6FooPrivate' targets have been split into separate CMake files
in Qt 6.9, and require a 'find_package(Qt6FooPrivate)' call starting
with Qt 6.10.

See also: https://bugreports.qt.io/browse/QTBUG-87776
---
 CMakeLists.txt                          | 4 ++++
 src/qtxdg/CMakeLists.txt                | 2 ++
 src/xdgiconloader/CMakeLists.txt        | 2 ++
 src/xdgiconloader/plugin/CMakeLists.txt | 2 ++
 4 files changed, 10 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7007a121..c12afec5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,10 @@ find_package(Qt6 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Widgets Svg Xml DBus)
 find_package(GLIB ${GLIB_MINIMUM_VERSION} REQUIRED COMPONENTS gobject gio gio-unix)
 find_package(XTerm)
 
+if (Qt6Gui_VERSION VERSION_GREATER_EQUAL "6.10.0")
+    find_package(Qt6GuiPrivate ${QT_MINIMUM_VERSION} REQUIRED)
+endif()
+
 include(GNUInstallDirs)             # Standard directories for installation
 include(CMakePackageConfigHelpers)
 include(GenerateExportHeader)
diff --git a/src/qtxdg/CMakeLists.txt b/src/qtxdg/CMakeLists.txt
index edd37416..2e8e8482 100644
--- a/src/qtxdg/CMakeLists.txt
+++ b/src/qtxdg/CMakeLists.txt
@@ -78,6 +78,8 @@ add_library(${QTXDGX_LIBRARY_NAME} SHARED
 )
 
 target_link_libraries(${QTXDGX_LIBRARY_NAME}
+    PRIVATE
+        Qt6::GuiPrivate
     PUBLIC
         ${QTX_LIBRARIES}
         ${QTXDGX_ICONLOADER_LIBRARY_NAME}
diff --git a/src/xdgiconloader/CMakeLists.txt b/src/xdgiconloader/CMakeLists.txt
index fba72e98..1bcae060 100644
--- a/src/xdgiconloader/CMakeLists.txt
+++ b/src/xdgiconloader/CMakeLists.txt
@@ -50,6 +50,8 @@ target_include_directories(${QTXDGX_ICONLOADER_LIBRARY_NAME}
 )
 
 target_link_libraries(${QTXDGX_ICONLOADER_LIBRARY_NAME}
+    PRIVATE
+        Qt6::GuiPrivate
     PUBLIC
         Qt6::Gui
         Qt6::Svg
diff --git a/src/xdgiconloader/plugin/CMakeLists.txt b/src/xdgiconloader/plugin/CMakeLists.txt
index 04564c47..1c37011c 100644
--- a/src/xdgiconloader/plugin/CMakeLists.txt
+++ b/src/xdgiconloader/plugin/CMakeLists.txt
@@ -11,6 +11,8 @@ target_compile_definitions(${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME}
         "QT_NO_KEYWORDS"
 )
 target_link_libraries(${QTXDGX_ICONENGINEPLUGIN_LIBRARY_NAME}
+    PRIVATE
+        Qt6::GuiPrivate
     PUBLIC
         Qt6::Gui
         "${QTXDGX_ICONLOADER_LIBRARY_NAME}"
