Modern CMake for C++ Course Syllabus
Full curriculum breakdown — modules, lessons, estimated time, and outcomes.
Overview: This course provides a comprehensive, hands-on introduction to modern CMake for C++ development, guiding you from foundational concepts to advanced build system design. Over eight modules, each designed to take approximately one week, you'll gain practical experience in structuring cross-platform projects, managing dependencies, configuring build generators, and implementing automated testing and packaging. With a focus on target-based CMake practices and real-world workflows, this course prepares you to build robust, maintainable C++ projects. Estimated total time commitment: 40-50 hours.
Module 1: Introduction to Modern CMake
Estimated time: 6 hours
- CMake philosophy and design principles
- Evolution and improvements in CMake 3+
- Basic structure of CMakeLists.txt
- Converting Makefile projects to CMake
Module 2: Targets & Properties
Estimated time: 6 hours
- Difference between add_library and add_executable
- Using target_include_directories for header paths
- Setting target-specific compile features with target_compile_features
- Understanding target scope and property inheritance
Module 3: Dependency Management
Estimated time: 7 hours
- Using find_package to locate system libraries
- Integrating remote dependencies with FetchContent
- Managing dependencies with add_subdirectory
- Differentiating interface, public, and private usage requirements
Module 4: Build Configuration & Generators
Estimated time: 7 hours
- Configuring CMake presets for different environments
- Setting build types (Debug, Release, etc.)
- Generating projects for Ninja and Make
- Creating Visual Studio and Xcode project files
Module 5: Custom Commands & Code Generation
Estimated time: 7 hours
- Using add_custom_command for build-time scripts
- Defining add_custom_target for custom build steps
- Generating source files at build time (e.g., with Python)
- Distinguishing host tools from cross-compilation contexts
Module 6: Testing & Packaging
Estimated time: 6 hours
- Enabling testing with enable_testing
- Adding test cases using add_test
- Integrating with CTest for test execution
- Creating distributable packages with CPack (ZIP, TGZ)
Module 7: Advanced Features & Toolchain Files
Estimated time: 7 hours
- Using generator expressions for conditional logic
- Working with imported targets
- Writing custom toolchain files
- Cross-compiling for ARM using toolchain configurations
Module 8: Capstone Project – Multi-Module C++ App
Estimated time: 8 hours
- Structuring a large-scale C++ application with multiple modules
- Isolating third-party dependencies
- Implementing reproducible builds with presets and version control
Prerequisites
- Familiarity with C++ syntax and compilation process
- Basic understanding of command-line tools and shell commands
- Experience with a code editor or IDE for C++ development
What You'll Be Able to Do After
- Write modern, maintainable CMakeLists.txt using target-based practices
- Structure cross-platform C++ projects with out-of-source builds
- Manage dependencies using find_package, FetchContent, and subprojects
- Generate IDE and build system files using CMake presets and generators
- Implement automated testing and packaging workflows with CTest and CPack