33-Part Main Series
All Articles in This Series
The complete CMake pipeline — from installation and first builds to professional project architecture, packaging, and CI/CD integration.
Part 1
Getting Started with CMake
Install CMake on Windows, macOS, and Linux. Build your first project using the command-line interface and understand the configure-generate-build workflow.
Read Article →
Part 2
The CMake Language
Master CMake command invocations, arguments, variables, lists, control structures, functions, macros, and comments — the full language specification.
Read Article →
Part 3
From Source Files to Executables
Compile single and multiple source files, switch generators (Make, Ninja, VS), set build types (Debug, Release), and control compiler options.
Read Article →
Part 4
Building and Linking Libraries
Create static, shared, and object libraries. Understand linking semantics, symbol visibility, RPATH, and the differences between library types.
Read Article →
Part 5
Working with Targets
Deep dive into CMake targets — properties, INTERFACE vs PRIVATE vs PUBLIC, transitive dependencies, alias targets, and imported targets.
Read Article →
Part 6
Compiler Configuration and Flags
Set C/C++ standards, control compiler flags, present options to users, handle conditionals, and configure optimization levels per target.
Read Article →
Part 7
Generator Expressions
Master generator expressions for build-time conditional logic — boolean operators, target queries, platform checks, and output transformations.
Read Article →
Part 8
Detecting the Environment
Discover the operating system, processor architecture, instruction sets, and write platform-dependent and compiler-dependent source code.
Read Article →
Part 9
Detecting External Libraries
Use find_package, pkg-config, and custom find-modules to detect Python, BLAS, LAPACK, OpenMP, MPI, Eigen, Boost, and other installed libraries.
Read Article →
Part 10
Managing Dependencies with FetchContent
Bring in external dependencies at configure time using FetchContent, dependency providers, and version-controlled Git repositories.
Read Article →
Part 11
ExternalProject and Super Builds
Manage complex dependency trees with ExternalProject_Add, the superbuild pattern, and multi-repository project orchestration.
Read Article →
Part 12
Creating and Running Tests with CTest
Define unit tests, run them in parallel, use fixtures, handle expected failures, set timeouts, and run test subsets with CTest.
Read Article →
Part 13
Testing Frameworks Integration
Integrate Google Test, Catch2, and Boost.Test with CMake — automatic test discovery, linking, and dynamic analysis for memory defects.
Read Article →
Part 14
Configure-time and Build-time Operations
Run custom commands at configure and build time, probe compilation/linking/execution, and use generator expressions for fine-tuning.
Read Article →
Part 15
Generating Source Code
Generate sources at configure and build time, record version info from files and Git hashes, and use Python for code generation.
Read Article →
Part 16
Structuring Projects
Organise CMake projects with functions, macros, modules, add_subdirectory, target_sources, named arguments, and scope management.
Read Article →
Part 17
Using CMake in IDEs
Set up CMake projects in CLion, Visual Studio Code, and Visual Studio IDE with debugging, IntelliSense, and build integration.
Read Article →
Part 18
C++20 Modules Support
Enable C++20 modules in CMake, configure toolchain support, work with module partitions, and handle the module dependency graph.
Read Article →
Part 19
Program Analysis Tools
Integrate AddressSanitizer, ThreadSanitizer, clang-tidy, clang-format, cppcheck, and code coverage tools into your CMake build.
Read Article →
Part 20
Building Documentation
Automate documentation with Doxygen and Sphinx, add Graphviz diagrams, combine tools, and integrate into the build process.
Read Article →
Part 21
Installing Your Project
Write install rules, generate export headers, export targets for downstream consumers, and install superbuilds properly.
Read Article →
Part 22
Packaging with CPack
Generate source and binary packages with CPack — TGZ, ZIP, DEB, RPM, NSIS installers, and component-based packaging strategies.
Read Article →
Part 23
CMake Presets
Encapsulate project configurations into CMakePresets.json — configure, build, test, and workflow presets for reproducible builds.
Read Article →
Part 24
Mixed-Language Projects
Build projects mixing C, C++, Fortran, and Python using Cython, Boost.Python, pybind11, and Python CFFI bindings.
Read Article →
Part 25
Cross-Compilation and Toolchains
Write toolchain files, use sysroots, cross-compile for ARM/embedded targets, and integrate custom toolchains with CMake presets.
Read Article →
Part 26
Alternative Generators
Compare Make, Ninja, Visual Studio, and Xcode generators. Configure multi-config builds and choose the right generator for your workflow.
Read Article →
Part 27
Testing Dashboards with CDash
Deploy tests to CDash, report code coverage, integrate AddressSanitizer and ThreadSanitizer results, and monitor project health.
Read Article →
Part 28
Porting Projects to CMake
Migrate from Makefiles, Autotools, or custom scripts to CMake — strategy, platform checks, dependencies, flags, tests, and common pitfalls.
Read Article →
Part 29
Creating Reproducible Build Environments
Build portable environments with Docker, sysroots, and CMake presets that work identically across developer machines and CI/CD pipelines.
Read Article →
Part 30
Optimizing Build Performance
Speed up builds with ccache/sccache, unity/jumbo builds, precompiled headers, parallel compilation, and link-time optimization strategies.
Read Article →
Part 31
Apple Platform Development
Build app bundles, frameworks, universal binaries, and code-signed artifacts for macOS and iOS using CMake and Xcode integration.
Read Article →
Part 32
Distributing Python Extensions
Build and distribute C/C++ Python extensions via PyPI and Conda using pybind11, CFFI, scikit-build, and conda-build integration.
Read Article →
Part 33
Professional CMake Project
Apply everything from the series to build a complete, professional-grade C++ project with testing, packaging, documentation, and CI/CD.
Read Article →
18 Library Integration Deep Dives
Library Integration Deep Dives
Hands-on guides for integrating popular C/C++ libraries into your CMake project — from find_package configuration to complete working examples.
Utility
Boost Libraries
Integrate Boost header-only and compiled libraries, select components, and handle version requirements.
Read Deep Dive →
GUI
Qt Framework
Set up Qt5/Qt6, handle MOC/UIC/RCC, manage QML resources, and deploy Qt applications cross-platform.
Read Deep Dive →
Vision
OpenCV
Find and link OpenCV modules, enable CUDA acceleration, and use opencv_contrib extras in your project.
Read Deep Dive →
Math
Eigen
Integrate Eigen for linear algebra, enable vectorization, and configure SIMD instruction sets for optimal performance.
Read Deep Dive →
Math
FFTW
Link FFTW for fast Fourier transforms, handle single/double precision variants, and manage threading support.
Read Deep Dive →
Math
BLAS and LAPACK
Detect and link BLAS/LAPACK implementations (OpenBLAS, MKL, Apple Accelerate) using CMake’s built-in find modules.
Read Deep Dive →
Testing
Google Test
Fetch or find GoogleTest, link GTest and GMock, use gtest_discover_tests for automatic test registration.
Read Deep Dive →
Testing
Catch2
Integrate Catch2 v3, use catch_discover_tests, configure BDD-style testing, and handle single-header vs installed modes.
Read Deep Dive →
Bindings
pybind11
Create Python bindings with pybind11, use pybind11_add_module, and distribute via scikit-build-core and PyPI.
Read Deep Dive →
Serialization
Protocol Buffers
Integrate protobuf and gRPC, run protoc code generation at build time, and link generated sources to targets.
Read Deep Dive →
Parallel
OpenMP
Enable OpenMP parallelization, detect version support, configure threading and SIMD directives per-target.
Read Deep Dive →
Parallel
MPI
Detect MPI implementations, link C/C++/Fortran components, and configure distributed computing targets.
Read Deep Dive →
Graphics
Vulkan and OpenGL
Find Vulkan SDK and OpenGL, link GLFW/GLEW/glad, compile GLSL shaders, and set up a rendering pipeline.
Read Deep Dive →
Networking
CURL
Find and link libcurl for HTTP/HTTPS operations, handle TLS backend selection, and configure protocol support.
Read Deep Dive →
Database
SQLite
Integrate SQLite via system install, amalgamation source, or FetchContent — with encryption extension support.
Read Deep Dive →
Formatting
fmt Library
Integrate {fmt} for fast formatting, choose header-only vs compiled mode, and transition to std::format.
Read Deep Dive →
Logging
spdlog
Add spdlog for fast async logging, configure sinks, link with bundled or external fmt, and set log levels per target.
Read Deep Dive →
Utility
Abseil (absl)
Integrate Google’s Abseil library, select components, handle the abseil-cpp CMake integration, and resolve ABI concerns.
Read Deep Dive →
9 Platform Deep Dives
Platform Deep Dives
Platform-specific guides for configuring CMake on each major operating system, embedded target, and containerized environment.
Windows
Windows with MSVC
Configure CMake for Windows development — MSVC toolchain, vcpkg integration, DLL export macros, and Windows-specific APIs.
Read Deep Dive →
Linux
Linux with GCC
Optimize CMake for Linux — GCC/Clang toolchains, system package managers, RPATH handling, and FHS-compliant installs.
Read Deep Dive →
macOS
macOS with Clang
Configure for macOS — AppleClang vs upstream Clang, Homebrew paths, universal binaries, and @rpath conventions.
Read Deep Dive →
Android
Android NDK
Build native libraries for Android using the NDK toolchain, target multiple ABIs, and integrate with Gradle builds.
Read Deep Dive →
iOS
iOS Development
Cross-compile for iOS devices and simulators, create frameworks, handle code signing, and integrate with Xcode projects.
Read Deep Dive →
Embedded
Embedded ARM (Bare Metal)
Set up arm-none-eabi-gcc toolchain, configure linker scripts, flash binaries, and target STM32/Cortex-M microcontrollers.
Read Deep Dive →
WebAssembly
WebAssembly with Emscripten
Compile C/C++ to WebAssembly using Emscripten’s CMake toolchain, configure memory, and bind JavaScript APIs.
Read Deep Dive →
SBC
Raspberry Pi
Build natively or cross-compile for Raspberry Pi, access GPIO/I2C/SPI hardware, and optimise for ARM64 architecture.
Read Deep Dive →
Container
Docker Build Environments
Create reproducible Docker-based build environments, multi-stage builds, cache CMake artifacts, and integrate with CI/CD.
Read Deep Dive →