Skip to content

X-Gen-Lab/cmake-mastery-learning-path

Repository files navigation

CMake Mastery Learning Path

Welcome to the CMake Mastery Learning Path! This is a systematic learning system designed to help you grow from a beginner to a CMake expert.

中文版本 | English Version

Project Overview

This project provides a complete CMake learning system, including:

  • Progressive Learning Modules: From basics to advanced, step by step
  • Practical Projects: Consolidate knowledge through real-world projects
  • Reference Materials: Cheatsheets, best practices, and troubleshooting guides
  • Progress Tracking: Clear learning path and milestones

Learning Modules

📚 01-basics - Fundamentals

Learn basic CMake concepts, syntax, and simple project configuration.

Topics: CMake introduction, first project, basic commands (project, add_executable, add_library)

Estimated Time: 2-3 weeks

📚 02-intermediate - Intermediate

Master variables, control flow, functions, and external library integration.

Topics: Variables, conditionals, functions/macros, find_package, generator expressions

Estimated Time: 3-4 weeks

📚 03-advanced - Advanced

Learn modern CMake best practices and advanced features.

Topics: Modern CMake, custom commands, install/export, package config, toolchains, CTest

Estimated Time: 4-5 weeks

🚀 04-projects - Real-World Projects

Apply your knowledge through comprehensive projects.

Projects: C++ library project, cross-platform application, complex dependency management

Estimated Time: 3-4 weeks

📖 05-reference - Reference Materials

Quick reference resources for daily work.

Content: Command cheatsheet, best practices, common errors, code templates

Prerequisites

Required Tools

  • CMake: Version 3.15 or higher

  • C++ Compiler: Any of the following

    • Windows: Visual Studio 2017+ or MinGW
    • Linux: GCC 7+ or Clang 6+
    • macOS: Xcode Command Line Tools
  • Build Tools:

    • Windows: Visual Studio or Ninja
    • Linux/macOS: Make or Ninja

Recommended Tools

  • Git: For version control and getting example code
  • Text Editor/IDE: VS Code, CLion, Visual Studio, etc.

Background Knowledge

  • Basic C/C++ programming knowledge
  • Command line basics
  • Understanding of compilation and linking concepts

Quick Start Guide

1. Verify Environment

# Check CMake version
cmake --version

# Check compiler
# Windows (MSVC)
cl

# Linux/macOS (GCC)
gcc --version

# Linux/macOS (Clang)
clang --version

2. Start Learning

  1. Read Learning Path: Check LEARNING_PATH.md for the complete roadmap
  2. Start with Basics: Enter 01-basics directory to begin the first module
  3. Follow Tutorials: Read tutorial documents in order
  4. Run Examples: Build and run example code
  5. Complete Exercises: Consolidate knowledge through exercises
  6. Track Progress: Check off completed items in LEARNING_PATH.md

3. Build Your First Example

# Enter example directory
cd 01-basics/examples/hello-world

# Create build directory
mkdir build
cd build

# Configure project
cmake ..

# Build project
cmake --build .

# Run program
# Windows
.\Debug\hello.exe

# Linux/macOS
./hello

Learning Recommendations

Learning Strategy

  1. Progressive Learning: Follow modules in order, don't skip basics
  2. Hands-On Practice: Run example code for every tutorial
  3. Complete Exercises: Exercises are key to consolidating knowledge
  4. Take Notes: Record important concepts and common pitfalls
  5. Reference Documentation: Consult 05-reference directory when encountering issues

Time Management

  • Weekly Investment: Recommended 5-10 hours per week
  • Total Time: Complete learning path takes approximately 12-16 weeks
  • Flexible Adjustment: Adjust learning pace based on your background and available time

Getting Help

Project Structure

cmake-mastery-learning-path/
├── README.md                    # This file (English)
├── CONTRIBUTING.md              # Contribution guidelines (English)
├── CHANGELOG.md                 # Change log (English)
├── LEARNING_PATH.md             # Learning path and progress tracking
├── docs/
│   ├── zh-CN/                   # Chinese documentation
│   │   ├── README.md            # Project README (Chinese)
│   │   ├── CONTRIBUTING.md      # Contribution guide (Chinese)
│   │   └── CHANGELOG.md         # Change log (Chinese)
│   ├── performance-optimization.md  # Performance optimization guide
│   └── project-organization.md  # Project organization guide
├── 01-basics/                   # Basics module
│   ├── README.md                # Module overview
│   ├── tutorials/               # Tutorial documents
│   ├── examples/                # Runnable example code
│   └── exercises/               # Exercise projects (with starter and solution)
├── 02-intermediate/             # Intermediate module
│   ├── README.md
│   ├── tutorials/
│   ├── examples/
│   └── exercises/
├── 03-advanced/                 # Advanced module
│   ├── README.md
│   ├── tutorials/
│   ├── examples/
│   └── exercises/
├── 04-projects/                 # Real-world projects module
│   ├── project-01-cpp-library/  # C++ library project
│   ├── project-02-cross-platform-app/  # Cross-platform application
│   └── project-03-complex-deps/ # Complex dependencies project
├── 05-reference/                # Reference materials
│   ├── cheatsheet.md            # Command cheatsheet
│   ├── best-practices.md        # Best practices
│   ├── common-errors.md         # Common errors
│   ├── resources.md             # External resources
│   └── templates/               # Code templates
├── docs/                        # Additional documentation
│   ├── zh-CN/                   # Chinese documentation
│   │   ├── README.md            # Project README (Chinese)
│   │   ├── CONTRIBUTING.md      # Contribution guide (Chinese)
│   │   └── CHANGELOG.md         # Change log (Chinese)
│   ├── project-organization.md  # Project organization guide
│   └── performance-optimization.md  # Performance optimization guide
└── tests/                       # Testing framework

Complete Project Navigation

Basics (01-basics)

Tutorials:

Examples:

Exercises:

Intermediate (02-intermediate)

Tutorials:

Examples:

Exercises: 5 exercise projects covering variables, conditional compilation, multi-directory structures, etc.

Advanced (03-advanced)

Tutorials:

Examples:

Exercises: 5 advanced exercise projects

Real-World Projects (04-projects)

Reference Materials (05-reference)

Additional Documentation (docs)

Frequently Asked Questions (FAQ)

General Questions

Q: How long does it take to complete the entire learning path?

A: The complete learning path takes approximately 12-16 weeks, with 5-10 hours per week. The actual time depends on your background and learning pace.

Q: Can I skip certain modules?

A: It's not recommended to skip the basics module. If you already have some CMake experience, you can quickly review the basic content, but it's recommended to at least complete the exercises to ensure understanding.

Q: Which CMake version should I use?

A: CMake 3.15 or higher is recommended. The examples and tutorials in this project are based on modern CMake practices and require newer version support.

Q: Do I need to know C++?

A: Yes, basic C/C++ programming knowledge is required. CMake is a build system primarily used for C/C++ projects.

Technical Questions

Q: CMake configuration fails with "compiler not found" error?

A: Ensure a C++ compiler is installed and added to system PATH. Windows users may need to run CMake in Visual Studio Developer Command Prompt.

Q: How to use MinGW instead of MSVC on Windows?

A: Use the -G "MinGW Makefiles" option:

cmake -G "MinGW Makefiles" ..

Q: What if example build fails?

A:

  1. Check if CMake version meets requirements
  2. Review error messages, refer to common-errors.md
  3. Ensure all dependencies are installed
  4. Try cleaning build directory and rebuilding

Q: How to switch between different build types (Debug/Release)?

A: Use the -DCMAKE_BUILD_TYPE option:

# Debug build
cmake -DCMAKE_BUILD_TYPE=Debug ..

# Release build
cmake -DCMAKE_BUILD_TYPE=Release ..

Q: Exercise starter code is incomplete?

A: This is intentional! The purpose of exercises is for you to complete the missing parts. If you encounter difficulties, you can check the reference answer and EXPLANATION.md in the solution directory.

Learning Strategy

Q: Should I read tutorials or examples first?

A: It's recommended to read tutorials first to understand concepts, then run example code, and finally complete exercises. This helps consolidate knowledge better.

Q: I've completed all exercises, what's next?

A:

  1. Complete real-world projects in 04-projects
  2. Try applying CMake to your own projects
  3. Read advanced topics in docs directory
  4. Refer to best practices in 05-reference to optimize existing projects

Q: How to track my learning progress?

A: Use the LEARNING_PATH.md file to check off completed tutorials, examples, and exercises.

Contributing

We welcome and appreciate all forms of contributions!

How to Contribute

  1. Report Issues

    • Found errors or unclear instructions
    • Example code doesn't run
    • Spelling or grammar errors in documentation
  2. Improve Content

    • Enhance tutorial explanations
    • Add more examples
    • Improve exercise projects
    • Update outdated information
  3. Add New Content

    • New example projects
    • Additional exercises
    • Supplementary documentation
    • Best practice cases
  4. Share Experience

    • Learning insights
    • Practical tips
    • Common problem solutions

Contribution Process

  1. Fork this repository
  2. Create feature branch (git checkout -b feature/your-feature)
  3. Commit changes (git commit -m 'Add some feature')
  4. Push to branch (git push origin feature/your-feature)
  5. Create Pull Request

For detailed contribution guidelines, see CONTRIBUTING.md.

Code Standards

  • CMake Code: Follow modern CMake best practices (refer to 05-reference/best-practices.md)
  • Documentation: Use clear, concise language with consistent formatting
  • Examples: Ensure all examples build successfully and include detailed README
  • Exercises: Provide clear task descriptions and complete solutions

Testing

Before submitting Pull Request, ensure:

  1. All new examples build successfully
  2. Exercise solution code is tested
  3. Documentation links are correct
  4. Run test suite (if applicable)
# Run tests
cd tests
pytest -v

License

This project is licensed under the MIT License. See LICENSE file for details.

Acknowledgments

Thanks to all developers and educators who contribute to the CMake community, especially:

  • CMake official team
  • All developers contributing examples and documentation
  • Learners providing feedback and suggestions

Contact

  • Issue Reporting: Via GitHub Issues
  • Discussion: Via GitHub Discussions
  • Documentation Issues: See common-errors.md

Ready? Let's start your CMake mastery journey from LEARNING_PATH.md!

🚀 Quick Links:

Version Information

  • Current Version: 1.0.0
  • Release Date: 2026-01-29
  • CMake Version: 3.15+
  • Status: Stable
  • 中文文档: docs/zh-CN/

For version history and updates, see CHANGELOG.md.

About

欢迎来到 CMake 精通学习路径!这是一个系统化的学习系统,旨在帮助你从零基础逐步成长为 CMake 专家。

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors