cmake

Define modern CMake workflows for C/C++ projects with target-centric design.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/awfixers-stuff/opencode-config --skill cmake-awfixers-stuff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cmake
Source: https://github.com/awfixers-stuff/opencode-config/tree/main/skills/cmake
Command: npx skills add https://github.com/awfixers-stuff/opencode-config --skill cmake-awfixers-stuff

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Modern CMake workflows improve build reliability, portability, and maintainability for C/C++ projects by emphasizing target-centric design, out-of-source builds, and clean dependency management.

Core Features & Use Cases

  • Modern, target-first CMake practices with PUBLIC/PRIVATE/INTERFACE usage
  • Support for out-of-source builds, multiple generators, and cross-platform configurations
  • Dependency integration using find_package, FetchContent, and packaging workflows
  • CI/IDE integration with toolchain files, sanitizers, and CMake presets

Quick Start

Create a minimal modern CMake project with an out-of-source build and a simple executable to validate the setup.

Frequently Asked Questions about cmake

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

FAQPage Schema
How do I set up a modern CMake project for C++ with target-centric design?

Modern CMake projects use target-centric design to attach properties like include directories and compile options directly to targets using PUBLIC, PRIVATE, or INTERFACE keywords. This replaces global commands, improving build reliability and maintainability.

What is the best way to manage C++ dependencies with CMake FetchContent?

CMake FetchContent allows you to download and configure dependencies at configure time, defining them as standard targets. This integrates external libraries directly into your build system without requiring pre-installation, streamlining dependency management across projects.

How do I configure CMake presets for CI and IDE toolchain workflows?

CMake presets define configure, build, and test settings in a JSON file to standardize toolchain selection and generator configuration. This enables consistent CI integration and IDE workflows by sharing configuration across different environments.

Does CMake support cross-compilation and multi-configuration setups for C++ projects?

CMake supports cross-compilation through toolchain files that specify target system compilers and sysroots, and handles multi-configuration setups with generators like Ninja Multi-Config. This allows building for different platforms and configurations from a single source tree.

When should I use out-of-source builds in CMake?

Out-of-source builds keep build artifacts separate from source files by generating outputs in a dedicated directory. This prevents source tree pollution, allows multiple builds with different configurations, and simplifies cleanup.

How do I add sanitizers and find_package integration to a CMake build system?

CMake integrates sanitizers by adding compile and link flags like -fsanitize=address to your targets, while find_package locates installed dependencies by searching standard paths and config files. These features enhance code quality and extend build capabilities.