Skip to content

Modern target-first CMake guidance for C/C++ builds, from project setup through cross-compilation and presets.

CCM score
62 of 100
skills.sh installs
1.9K
GitHub stars
303
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers out-of-source configure and build, generator selection (Ninja, Make, VS), target linking with PUBLIC/PRIVATE/INTERFACE, and install rules
  • Includes dependency patterns for find_package, FetchContent, and pkg-config fallback, plus sanitizer toggles and cross-compile toolchain files
  • Enforces target-first conventions by steering away from legacy include_directories() and link_libraries() commands
  • Designed for agents writing or refactoring CMakeLists.txt, debugging configure errors, or setting up CMake Presets

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill cmake -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

CMake

Purpose

Guide agents through modern (target-first) CMake for C/C++ projects: out-of-source builds, dependency management, generator selection, and integration with CI and IDEs.

Triggers

  • "How do I write a CMakeLists.txt for my project?"
  • "How do I add an external library with CMake?"
  • "CMake can't find my package / library"
  • "How do I enable sanitizers in CMake?"
  • "How do I cross-compile with CMake?"
  • "How do I use CMake Presets?"

Workflow

1. Modern CMake principles

  • Define targets, not variables. Use target_* commands.
  • Use PUBLIC/PRIVATE/INTERFACE to control property propagation.
  • Never use include_directories() or link_libraries() (legacy).
  • Minimum CMake version: cmake_minimum_required(VERSION 3.20) for most features.

2. Minimal project

cmake_minimum_required(VERSION 3.20)
project(MyApp VERSION 1.0 LANGUAGES C CXX)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(myapp
    src/main.c
    src/utils.c
)

target_include_directories(myapp PRIVATE include)
target_compile_options(myapp PRIVATE -Wall -Wextra)

Details

Repository
github.com/mohitmishra786/low-level-dev-skills
Category
CLI & Terminal
First seen
May 16, 2026

More from mohitmishra786/low-level-dev-skills

All 54

Similar to Cmake

More CLI & Terminal