qt-compatibility-build

Detect Qt versions and map DTK dependencies in CMake projects.

7|3|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/re2zero/deepin-skills --skill qt-compatibility-build
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: qt-compatibility-build
Source: https://github.com/re2zero/deepin-skills/tree/main/qt-compatibility-build
Command: npx skills add https://github.com/re2zero/deepin-skills --skill qt-compatibility-build

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill unifies and simplifies Deepin's Qt/CMake dual-version build configuration by automatically detecting Qt5/Qt6 and mapping DTK versions to the active Qt version, eliminating hard-coded references.

Core Features & Use Cases

  • Dual-version support: Builds for both Qt5 and Qt6 environments (V20 and V25) from the same codebase.
  • Dynamic DTK mapping: Automatically maps DTK versions to the detected Qt version to ensure correct dependencies.
  • No hard-coded version references: Centralizes version handling to reduce maintenance and errors.
  • Use Case: When maintaining a Deepin project that needs V25/Qt6 and V20/Qt5 compatibility, this skill ensures builds adapt automatically.

Quick Start

To enable dual Qt support in your CMake project, integrate the detection logic at the top of your CMakeLists.txt and replace hard-coded Qt and DTK references with the dynamic variables Qt${QT_VERSION_MAJOR} and Dtk${DTK_VERSION_MAJOR}.

Frequently Asked Questions about qt-compatibility-build

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure CMake to support both Qt5 and Qt6 builds in the same project?

To support both Qt5 and Qt6 in CMake, integrate detection logic at the top of your CMakeLists.txt and replace hard-coded references with dynamic variables like Qt${QT_VERSION_MAJOR}. This allows a single codebase to adapt automatically to the detected Qt environment.

How does dynamic DTK version mapping work for Deepin projects?

Dynamic DTK version mapping automatically detects the active Qt version and maps the corresponding DTK dependencies accordingly. This ensures your Deepin project links the correct DTK libraries without requiring manual version updates in your build configuration.

Why does my CMake build fail when upgrading from V20 to V25 with hard-coded Qt references?

CMake builds fail during a V20 to V25 upgrade because hard-coded Qt and DTK version references do not match the new environment. Removing these fixed references and using version-agnostic patterns allows the build to adapt dynamically.

Can I use this approach to build Deepin projects across different Qt versions without modifying CMakeLists?

Yes, you can build Deepin projects across Qt versions without modifying CMakeLists each time. By centralizing version handling with automated detection and variable mapping, the same codebase supports both V20 and V25 environments.

What's the best way to replace hard-coded find_package and target_link_libraries for dual Qt support?

The best way to replace hard-coded find_package and target_link_libraries is to update them with version-agnostic patterns using dynamic variables. This eliminates manual version management and ensures correct Qt and DTK dependency linking.

When do I need to use version-agnostic patterns for Qt and DTK in CMake?

You need version-agnostic patterns for Qt and DTK in CMake when maintaining a project that requires dual support for V25 and V20. This approach allows your build system to detect Qt versions dynamically and map DTK dependencies automatically.