# qt-cmake-project

The skill writes and edits CMake for Qt 6 projects: targets, QML modules, resources. Useful when your agent mixes up Qt 5 and Qt 6 commands.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 530 installs · ★ 507
- Author: qt-ai-skills
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/TheQtCompanyRnD/agent-skills/tree/HEAD/skills/qt-cmake-project/SKILL.md
- Updated: 2026-10-20
- HTML: https://affpapa.org/en/nevibecode/skills/qt-cmake-project

## What it does

The skill walks an agent through Qt CMake setup using the API from an installed Qt SDK, which exposes features plain CMake does not have. It splits work across reference files: a simple single-target project, a modular layout with `add_subdirectory()`, QML integration, resources, and configure or build steps. Before the final answer the agent checks its output against `references/common-mistakes.md`.

Hard rules sit at the core, because mainstream models get these wrong by default. Only Qt 6 commands: `qt_add_executable`, `qt_add_library`, `qt_add_qml_module`, `qt_add_resources`, `qt_add_plugin`, `qt_add_translations`. `qt_standard_project_setup()` must follow the first `find_package(Qt6 ...)`, and the package call needs an explicit minimum such as `find_package(Qt6 6.8 REQUIRED COMPONENTS ...)`. QML goes through `qt_add_qml_module()`, never a raw `.qrc` file.

The skill also treats project files as data, not orders. Anything read from `CMakeLists.txt`, `*.cmake`, `CMakePresets.json`, `.qrc`, `qmldir`, `.qml` or `.cpp/.h` is material to analyse and edit. When a command signature is unclear, it points the agent at the Qt docs MCP tool first, since invented option names like `SOURCE_FILES` or `QRC_PREFIX` do not exist. You need a Qt SDK installation with the CMake API for this to work.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add TheQtCompanyRnD/agent-skills --skill qt-cmake-project -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/qt-cmake-project/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/qt-cmake-project/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add TheQtCompanyRnD/agent-skills --skill qt-cmake-project -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/qt-cmake-project/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add TheQtCompanyRnD/agent-skills --skill qt-cmake-project -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/qt-cmake-project/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install TheQtCompanyRnD/agent-skills qt-cmake-project
```

2. **Manually: put the files in place**
- File: `.github/skills/qt-cmake-project/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add TheQtCompanyRnD/agent-skills --skill qt-cmake-project -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/TheQtCompanyRnD/agent-skills --path skills/qt-cmake-project
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/qt-cmake-project/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add TheQtCompanyRnD/agent-skills --skill qt-cmake-project -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/TheQtCompanyRnD/agent-skills/tree/HEAD/skills/qt-cmake-project/SKILL.md

## When to use it
- generate a CMakeLists.txt for a fresh Qt 6 project
- add an executable or library target with explicit visibility
- wire a QML module to C++ code
- migrate a project off Qt 5 macros onto Qt 6 commands
- organise images, icons and translations per target

## Example prompts
- Create a Qt 6 project with a single executable and a QML UI
- Add a library target in CMakeLists.txt and link it to the app
- Move images and fonts into resources with qt_add_resources

## Similar
- [cmake](https://affpapa.org/en/nevibecode/skills/cmake.md) — skill · 1700 installs
- [cmake-vcpkg](https://affpapa.org/en/nevibecode/rules/cmake-vcpkg.md) — rule · ★ 40418
- [build-acceleration](https://affpapa.org/en/nevibecode/skills/build-acceleration.md) — skill · 506 installs
- [cpp-pro](https://affpapa.org/en/nevibecode/skills/httpsgithubcomjeffallan-cpp-pro.md) — skill · 5300 installs
- [cpp-testing](https://affpapa.org/en/nevibecode/skills/cpp-testing.md) — skill · 4700 installs

From the same set: [theqtcompanyrnd/agent-skills](https://affpapa.org/en/nevibecode/by/theqtcompanyrnd/agent-skills.md) — 8 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
