From e152df42a91cf42139d151c0a3e50ef74058e739 Mon Sep 17 00:00:00 2001 From: pengfeixx <63588879+pengfeixx@users.noreply.github.com> Date: Tue, 10 Nov 2026 10:06:06 +0800 Subject: [PATCH] fix: explicitly find Qt6 private components on Qt >= 6.10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Qt 6.10 splits private module targets into standalone CMake packages, so Qt6::WidgetsPrivate/GuiPrivate are no longer auto-created by the main module's Targets.cmake 2. Linking Qt6::WidgetsPrivate now fails at configure time on the Qt 6.12 build server: Target "deepin-diskmanager" links to Qt6::WidgetsPrivate but the target was not found 3. GuiPrivate in target_include_directories silently degrades to a literal string on 6.12, losing private header paths; find it too 4. Gate behind Qt6_VERSION >= 6.10; Qt <= 6.9 (incl. 6.8 baseline) keeps the auto-created targets, behavior unchanged Log: Fixed diskmanager configure failure on Qt 6.12 caused by private module targets being split into standalone CMake packages Influence: 1. Configure deepin-diskmanager against Qt 6.12, cmake passes 2. Verify private widget/gui headers still resolve at compile time 3. On Qt 6.8 confirm configure and build behavior unchanged fix: 显式查找 Qt6 私有组件以适配 Qt 6.10+ 1. Qt 6.10 将私有模块目标拆分为独立 CMake 包, Qt6::WidgetsPrivate/GuiPrivate 不再随主模块查找自动创建 2. Qt 6.12 服务器上链接 Qt6::WidgetsPrivate 在 configure 阶段 失败:Target "deepin-diskmanager" links to Qt6::WidgetsPrivate but the target was not found 3. target_include_directories 中的 GuiPrivate 在 6.12 下退化为 普通字符串,丢失私有头文件路径,一并显式查找 4. 以 Qt6_VERSION >= 6.10 门禁;Qt <= 6.9(含 6.8 基线)保持 自动创建行为不变 Log: 修复磁盘管理在 Qt 6.12 下因私有模块目标拆分导致的 configure 失败 Influence: 1. 在 Qt 6.12 环境配置磁盘管理,cmake 通过 2. 验证编译期私有 widget/gui 头文件路径仍正确解析 3. 在 Qt 6.8 环境确认 configure 与构建行为不变 --- application/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt index f92fc91..b5bb5c9 100644 --- a/application/CMakeLists.txt +++ b/application/CMakeLists.txt @@ -25,6 +25,12 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS LinguistTools REQUIRED) +# Qt 6.10 起,私有模块目标(如 Qt6::WidgetsPrivate/GuiPrivate)拆分为独立 CMake 包, +# 不再随主模块查找自动创建,需显式查找;更早版本由各 Targets.cmake 自动创建 +if (QT_VERSION_MAJOR MATCHES 6 AND Qt6_VERSION VERSION_GREATER_EQUAL 6.10) + find_package(Qt6 REQUIRED COMPONENTS WidgetsPrivate GuiPrivate) +endif() + set(LINK_LIBS Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::DBus