Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Private headers remain unavailable

When configuring with Qt 6.10 or newer and compiling code in an earlier or sibling directory that needs Qt GUI private headers, find_package creates the private targets in the application directory, so earlier and sibling directories cannot use them; meanwhile, target_include_directories treats Qt6::GuiPrivate as a directory string instead of applying its interface include paths. Compilation fails to find the private headers.

Make the private targets available to all consuming directories and link the appropriate private target to each consumer instead of passing it to target_include_directories.

Also at application/CMakeLists.txt:32.

Prompt for AI agents
In `application/CMakeLists.txt` at line 31:

**Private headers remain unavailable**

When configuring with Qt 6.10 or newer and compiling code in an earlier or sibling directory that needs Qt GUI private headers, `find_package` creates the private targets in the application directory, so earlier and sibling directories cannot use them; meanwhile, `target_include_directories` treats `Qt6::GuiPrivate` as a directory string instead of applying its interface include paths. Compilation fails to find the private headers.

Make the private targets available to all consuming directories and link the appropriate private target to each consumer instead of passing it to `target_include_directories`.

Also at `application/CMakeLists.txt:32`.

endif()

set(LINK_LIBS
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::DBus
Expand Down
Loading