Following the Professional CMake: A Practical Guide book, this repository contains training workshops with the aim of learning the CMake tool.
Workshops include custom projects and exercises to practice the concepts learned in the book. The workshops are written in modern CMake following the best practices and idioms.
Each chapter from the book will have a corresponding workshop as a CMake project.
- Chapter 01: Introduction
- Chapter 02: Setting Up A Project
- Chapter 03: A Minimal Project
- Chapter 04: Building Simple Targets
- Chapter 05: Basic Testing And Deployment
- Chapter 06: Variables
- Chapter 07: Flow Control
- Chapter 08: Using Subdirectories
- Chapter 09: Functions And Macros
- Chapter 10: Properties
- Chapter 11: Generator Expressions
- Chapter 12: Modules
- Chapter 13: Policies
- Chapter 14: Debugging And Diagnostics
- Chapter 15: Build Type
- Ensure you have CMake installed on your system (version 3.30 or later recommended).
- Familiarity with basic C++ programming is assumed.
- Access to the Professional CMake: A Practical Guide book is highly recommended.
Each chapter has its own directory (e.g., Chapter01
, Chapter02
, etc.)
Within each chapter directory, you'll find:
- A
README.md
file containing:- Part 1: Summary of key concepts from the book chapter
- Part 2: Workshop explanation and instructions
- Project files and directories for the workshop
Start with Chapter 01 and progress sequentially.
For each chapter:
- Read the corresponding chapter in the Professional CMake: A Practical Guide book.
- Attempt to complete the exercises on your own.
- If you're stuck, review the chapter's
README.md
in this repository for a summary of key points. - Use the provided workshop as a reference solution for comparison with your own work.
Each workshop can be built using the provided build scripts:
Remark: The build scripts are written in Fish shell for Linux/macOS and PowerShell for Windows.
- On Linux or macOS:
./tools/build.fish
- On Windows:
.\tools\build.ps1
Workshops can also be built using standard CMake commands:
mkdir build
cd build
cmake ..
cmake --build .
Specific build instructions, if different, will be provided in the chapter's README.
If you encounter issues or have questions, check the following resources:
- The chapter's README for any troubleshooting tips
- The official CMake documentation
- Open an issue in this repository for project-specific problems
Feedback and contributions are welcome! If you find errors or have suggestions for improvements, please open an issue or submit a pull request.