maxqian888/agentpack-gui/cpp-cmake
Claude Code and agent skill by maxqian888/agentpack-gui
- community
Checking that the SKILL.md file is still in the repository.
Use when building, configuring, or debugging C++ projects with CMake — setting up CMakeLists.txt, CMakePresets.json, toolchain files, vcpkg/Conan dependencies, out-of-source builds, C++23 standard, C++20 modules, install/export, cross-compilation, or diagnosing CMake/linker errors. Triggers on CMake, CMakePresets, C++ build, target_link_libraries, find_package, vcpkg, ninja, install(TARGETS), compile errors in C/C++ projects.
Install
npx vskill@latest install maxqian888/agentpack-gui/cpp-cmakeSKILL.md
C++ Engineering with CMake
Guidance for modern, maintainable C++ builds. Default to CMake ≥ 3.28 + presets + Ninja (current stable is the 4.x line, e.g. 4.3). A 3.28 floor unlocks C++20 modules and CMakePresets.json schema v8.
Project layout (out-of-source)
Always build out-of-source: cmake --preset debug && cmake --build --preset debug. Never run cmake . in the source tree.
Modern CMakeLists.txt skeleton
Target-centric rules — prefer target_* over global commands:
- Use
target_link_libraries,target_include_directories,target_compile_definitions. - Choose visibility deliberately:
PUBLIC(used by target + consumers),PRIVATE(target only),INTERFACE(consumers only). - Never hardcode
-I/-linCMAKE_CXX_FLAGS; never glob sources for build inputs you care about (globs miss new files unless re-configured).
CMakePresets.json
Dependencies
vcpkg (manifest mode) — add vcpkg.json with a dependencies array plus a builtin-baseline (a vcpkg commit SHA) so versions are reproducible; generate it with vcpkg x-update-baseline --add-initial-baseline. Then point CMake at the toolchain file via a preset:
Then find_package(fmt CONFIG REQUIRED) and target_link_libraries(app PRIVATE fmt::fmt). Use vcpkg-configuration.json to add overlay/extra registries.
FetchContent for header-only / small deps without a package manager:
Testing with CTest
Run: ctest --preset debug (or ctest --test-dir build/debug --output-on-failure).
Installing & exporting a library
Make a target consumable via find_package by other projects:
C++20 modules (optional)
Native since CMake 3.28 (Ninja + a scanning-capable compiler: MSVC 14.34+, Clang 16+, GCC 14+). Enable per target with set_target_properties(app PROPERTIES CXX_SCAN_FOR_MODULES ON). import std; is available from 3.30 via the experimental CXX_MODULE_STD property (C++23 only) — treat as bleeding-edge.
Common pitfalls
- "No CMAKE_CXX_COMPILER could be found" → install a compiler / on Windows run from a Developer prompt or install Ninja + MSVC/clang.
- Linker `undefined reference` → a
target_link_librariesis missing or link order matters for static libs; ensure the symbol's library is listed. - find_package fails → wrong
CMAKE_PREFIX_PATH/toolchain; useCONFIGmode for modern packages; check<pkg>_DIR. - Stale cache after editing CMakeLists → delete the
build/<preset>dir and re-configure if variables don't take effect. - compile_commands.json not found by clangd → ensure
CMAKE_EXPORT_COMPILE_COMMANDS=ONand symlink/copy it to the project root. - Verify changes by actually configuring + building + running CTest, not by reading CMakeLists alone.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc-tauri/assets/skills/cpp-cmake/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/maxqian888/agentpack-gui/cpp-cmake)