Edocti
Advanced Technical Training for the Software Engineer of Tomorrow
Edocti Training

Advanced CMake Topics

Advanced
21 h
4.9 (463 reviews)

Scheduled sessions

No sessions are available at the moment.
Advanced CMake Topics

Modern CMake mastery: Learn to use target-based CMake to cleanly configure, build, test, and package your C++ projects.

Understand the mechanics of generators (Ninja, Makefiles), toolchains, and policies. Write robust find_package configurations and export reusable targets.

Efficiently manage external dependencies using FetchContent and ExternalProject, and seamlessly integrate testing workflows with CTest and CDash.

Gain practical experience through intensive hands-on labs (~70% of the course) that mirror the complexity of real-world codebases.

How CMake helps: Ensure portability across platforms and compilers, achieve reproducible builds, maintain clear dependency graphs, and streamline CI/CD packaging with CPack.

Who it’s for: Software engineers with C++ or C experience who want to implement modern CMake best practices in their production teams.

By the end of the course, you’ll confidently structure enterprise projects, debug CMake scripts, and scale to advanced topics like CUDA, MPI, and cross-compiling.

Skills You Will Learn

Modern Target-Based CMake CMake Generators (Ninja/Make) Dependency Management CTest & CDash Integration Packaging with CPack Cross-Compiling & Toolchains CMake Debugging & Profiling CUDA & MPI Integration

Curriculum

Welcome and setup

  • Ensure development setup for C++ and CMake
  • Basic CMake installation and setup

CMake introduction

  • Overview of CMake and its role in modern build systems
  • CMake’s major features and benefits
  • Understanding the CMake workflow
  • Source configuration
  • Build system generation
  • Build execution

CMake workflow

  • CMake configuration workflow
  • Writing your first CMakeLists.txt
  • Configuring and generating a build system
  • Running CMake from the command line and IDEs
  • Understanding CMake generators (Makefiles, Ninja, etc.)

Building libraries and executables

  • Defining and managing targets in CMake
  • add_executable and add_library
  • Linking libraries and dependencies
  • target_link_libraries
  • Variables in CMake: regular vs. cache variables
  • Managing build configurations with CMake variables
  • Overview of modern CMake’s target-centric approach
  • Best practices for building and organizing projects
  • Compiler and compiler options specification
  • Language standard specifications
  • Detect and work with environment variables
  • Detect and work with various CPU architectures

More CMake syntax

  • CMake syntax and supported commands
  • Control flow in CMake scripts (if, foreach, while)
  • Using generator expressions ($<...>) for conditional logic
  • Target properties and advanced target management
  • Installing targets and creating installation rules
  • Practical hands-on tips and tricks

Importing and exporting targets

  • Creating exportable targets with install(EXPORT)
  • Using find_package() and writing Config files
  • Importing third‑party targets and managing dependencies
  • Best practices for reusable and portable CMake configurations

External Project and FetchContent

  • Introduction to external project management in CMake
  • Using ExternalProject_Add for building external dependencies
  • Overview of FetchContent for simplifying dependency management
  • Practical examples and use cases

CMake’s policy system

  • Understanding the CMake policy system
  • Handling policy warnings and errors
  • Adopting best practices for policy management
  • Noteworthy changes from recent CMake releases

Debugging and profiling CMake scripts

  • Debugging with message() and cmake --trace
  • Profiling CMake builds to optimize performance
  • Understanding and resolving common CMake issues

Companion tools and testing framework

  • Writing and running tests with CTest
  • Integrating test coverage and dynamic analysis tools
  • Introduction to CDash for continuous integration and testing
  • Overview of the packaging tool: CPack
  • Practical exercises with CTest and CPack

Advanced topics in CMake

  • CMake support for MPI (Message Passing Interface)
  • Setting up and managing MPI projects
  • CUDA support in CMake
  • Building CUDA applications with CMake
  • Cross compilation with CMake
  • Setting up toolchains and cross‑compiling projects
  • Fortran support in CMake
  • Configuring and building Fortran projects

Course Day Structure

  • Part one: 09:00–10:30
  • Coffee break: 10:30–10:45
  • Part two: 10:45–12:15
  • Lunch break: 12:15–13:15
  • Part three: 13:15–15:15
  • Coffee break: 15:15–15:30
  • Part four: 15:30–17:30

Did you attend this course?

Your feedback is invaluable to us. Please share your experience with us and help us improve this course for future participants.

Share your feedback

Want to find out more? We are here to help!

Or email us directly at training@edocti.com.