Repository navigation
fix: explicitly find Qt6 GuiPrivate component on Qt >= 6.10 - #52
Merged
deepin-bot[bot] merged 1 commit intoNov 6, 2026
Merged
Conversation
Since Qt 6.10, private module targets such as Qt6::GuiPrivate are
shipped as standalone CMake packages (Qt6GuiPrivateConfig.cmake) and
are no longer auto-created by Qt6GuiTargets.cmake when the main module
is found. As a result, linking Qt6::GuiPrivate without explicitly
finding the private component fails at configure time:
CMake Error at CMakeLists.txt (target_link_libraries):
Target "dde-device-formatter" links to: Qt6::GuiPrivate
but the target was not found.
This broke packaging on the Qt 6.12 build server (cmake configure step
of dh_auto_configure exits with code 1), same as deepin-screensaver
which was fixed the same way in linuxdeepin/deepin-screensaver#139.
After the main find_package(Qt6 ...) call, explicitly
find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) when the detected Qt
version is >= 6.10. On Qt <= 6.9 (including the 6.8 baseline) nothing
changes: the gate evaluates false and the target is still auto-created
by Qt6GuiTargets.cmake.
Verified:
- with qt6-base-dev 6.12.0-1 the Qt6GuiPrivate CMake package ships
Qt6GuiPrivateTargets.cmake defining Qt6::GuiPrivate (INTERFACE
IMPORTED), which this explicit lookup now consumes
- against Qt 6.8.0 the version gate evaluates false and configure
passes all Qt find_package steps unchanged
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates CMake dependency discovery so builds using Qt 6.10+ can resolve the separately packaged Flow diagram for Qt private component discoveryflowchart TD
A["find_package(Qt${QT_VERSION_MAJOR})"] --> B{"Qt version is 6.10 or newer?"}
B -->|Yes| C["find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)"]
B -->|No| D["Qt6::GuiPrivate auto-created by Qt6GuiTargets.cmake"]
C --> E["Qt6::GuiPrivate available"]
D --> E
E --> F["Configure target_link_libraries"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例# 当前代码已为最佳实践,无需修改。 # Qt 6.10 起,私有模块目标(如 Qt6::GuiPrivate)拆分为独立的 CMake 包,不再随主模块自动创建,需显式查找; # 更早版本该目标由 Qt6GuiTargets.cmake 自动创建,无需额外处理 if (QT_VERSION_MAJOR MATCHES 6 AND Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)
endif()本报告由 AI 代码审查工具自动生成 |
lzwind
approved these changes
Nov 6, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/merge |
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building dde-device-formatter 1.5.11 on the Qt 6.12 build server fails at the cmake configure step:
Since Qt 6.10, private module targets such as
Qt6::GuiPrivateare shipped as standalone CMake packages (Qt6GuiPrivateConfig.cmake, installed byqt6-base-devundercmake/Qt6GuiPrivate/) and are no longer auto-created byQt6GuiTargets.cmakewhen the main module is found. Linking the private target without explicitly finding the private component therefore fails at configure time.Same failure and same fix pattern as deepin-screensaver: linuxdeepin/deepin-screensaver#139
Changes
find_package(Qt${QT_VERSION_MAJOR} ...)call, explicitlyfind_package(Qt6 REQUIRED COMPONENTS GuiPrivate)when the detected Qt version is >= 6.10Qt6::GuiPrivateis still auto-created byQt6GuiTargets.cmakeTesting
qt6-base-dev 6.12.0-1package contents:cmake/Qt6GuiPrivate/Qt6GuiPrivateTargets.cmakeexists and definesadd_library(Qt6::GuiPrivate INTERFACE IMPORTED)— the explicit lookup introduced here consumes exactly this packagefind_packagesteps unchanged (behavior identical to before this change)Summary by Sourcery
Bug Fixes: