CMake Guide

1. Introduction It’s a meta-build system generator. How it works: We write high-level instructions in a CMakeLists.txt file (platform-agnostic).Then CMake generates build system files for the platform we choose: On Linux/Unix → generates Makefile (for make) or build.ninja (for ninja). On Windows → generates Visual Studio solutions (.sln). On macOS → can generate Xcode projects. 2. Setup Linux: Install: sudo apt install cmake , Verify: cmake --version 3. How to work with CMake Create CMakeLists.txt and resources file Create and cd to project-build folder & Run cmake <dir-contain-CMakeLists.txt> (cmake ../) to set up & generate build system. Run cmake --build <dir-contain-buildsystem> ( cmake --build ./) to actually build/compile the project. Run the target build (e.g. ./targetName) 3.1. CMakeLists.txt ...

August 21, 2025 · 1 min · Phong Nguyen