We may earn an affiliate commission when you visit our partners.
Course image
Sławomir Grabowski

For many developers CMake is not so intuitive, eg. because of the syntax. Others are able to see CMake documentation, but miss good practical examples. After more than 10 years of experience in programming and leading many CMake workshops I was ready to prepare multiplatform friendly course for beginners in CMake world and also for people that has experience in CMake that will help to solve that problems.

There is many tutorials and blog posts, so why this training? In this training I put not only theory that you can find in the popular websites, but firstly I present:

Read more

For many developers CMake is not so intuitive, eg. because of the syntax. Others are able to see CMake documentation, but miss good practical examples. After more than 10 years of experience in programming and leading many CMake workshops I was ready to prepare multiplatform friendly course for beginners in CMake world and also for people that has experience in CMake that will help to solve that problems.

There is many tutorials and blog posts, so why this training? In this training I put not only theory that you can find in the popular websites, but firstly I present:

  • good practices from first lecture

  • how to avoid making simple but hard to find mistakes

  • advantages and disadvantages of many solutions

This training is the first part of series "Effective Modern CMake".

In this training I try to avoid the command line that is usually good, but platform dependent, so never mind if you are using Windows, Linux or macOS. This training is for you. Moreover I show differences and in some topics dedicated solutions for each platform if it is needed. I prepared videos that help you setup environment in the most popular code editors like CLion, Visual Studio and Qt Creator. Of course you can use your favorite IDE.

Would you like to have an example of given topic, eg. integrating with C++ library? Put a comment and collect the vote.

Enroll now

What's inside

Learning objectives

  • Modern cmake approach
  • Cmake syntax and mechanics
  • Build system good practices
  • How to keep build system clean and developer friendly

Syllabus

Course introduction
Course scope - is this training for you?
How we will learn CMake?
Environment setup
Read more

In this lecture I explain how important is understanding cmake_minimum_required() function for project. I also present other functions that should be place in CMake project. Off course having "Hello World" message in first project is compulsory!

In this lecture I present how to declare variable and modify variables values. Off course CMake is CMake, so using variables cannot be too easy. I present also some traps that CMake syntax has for us and how to avoid bugprone situations.

This lecture is short, but it should be, because creating executable in CMake is very easy.

It is not enought to use target base approach over variable based approach. The power of Modern CMake starts to be visible when we introduce good build system structure. In this lecture I explain how to connect targets and add CMake subprojects to have well organized, flexible and effective CMake build system.

Conditions topic seems to be easy for every developer that has some experience in programing, but CMake again have a slightly different approach than standard programming languages. Understanding CMake conditions syntax is very important to be able to read the code and find root causes of some bugs.

In this lecture I show a way how we can pass values from CMake build system to source code (eg. C++, C).

When we have multiplatform project and we use shared libraries MSVC (Microsoft Visual Compiler) requires from us to add some changes to source files and build system. In this lecture I show the most optimal solution by using CMake mechanisms that we already know.

CMake Cache is a good mechanism, but there is some traps that wait for developers that are not aware about few things. In this lecture I explain how to use CMake Cache well and show good practices.

The tests are very important part of build system. In this lecture I show another advantage of the modern CMake project structure: adding test applications is very easy.

Traffic lights

Read about what's good
what should give you pause
and possible dealbreakers
Avoids the command line, which can be platform-dependent, making it accessible to users on Windows, Linux, and macOS, regardless of their prior experience
Presents good practices from the first lecture, helping learners establish a solid foundation in CMake development from the outset
Explains how important the `cmake_minimum_required()` function is for a project, ensuring learners understand crucial aspects of CMake from the beginning
Shows how to avoid making simple but hard-to-find mistakes, which is invaluable for beginners who are likely to encounter such issues
Is the first part of a series, suggesting a comprehensive and structured learning path for those looking to deepen their CMake knowledge
Requires learners to understand CMake conditions syntax, which is important to be able to read the code and find root causes of some bugs

Save this course

Create your own learning path. Save this course to your list so you can find it easily later.
Save

Reviews summary

Clear and practical introduction to modern cmake

According to learners, this course provides a largely positive introduction to modern CMake, particularly well-suited for beginners. Students found the explanations clear and easy to follow, effectively breaking down complex topics. Many appreciated the practical examples and hands-on approach, which made it easier to apply concepts immediately. The course's focus on multiplatform setup and guidance for popular IDEs was highlighted as very helpful. While some felt the pace was appropriate, a few noted that it serves primarily as a foundation and deeper dives into specific areas may be needed from subsequent courses.
Foundation course, requires follow-up.
"This course gives you a solid foundation to move on to more advanced CMake topics."
"I'm looking forward to the next parts of the series."
"It covers the essentials well but leaves you wanting more advanced techniques."
"Understandably, it can't cover everything in a single beginner course."
Covers topics at a suitable beginner pace.
"The pace felt just right for learning new concepts."
"Some topics felt rushed, while others were perhaps too detailed."
"It provides a good overview, but I'll need more advanced courses for deeper dives."
"Good coverage of all the essential beginner topics in the syllabus."
Helps set up CMake across OS/IDEs.
"The multiplatform setup guides were very useful for getting started on my specific OS."
"Appreciated the tips for VS and CLion integration."
"Getting the environment right on Windows with Ninja was easy following the videos."
"Still had some minor issues setting up on Linux, but the guidance helped."
Useful, hands-on coding examples provided.
"The hands-on examples were essential for solidifying my understanding."
"I could immediately apply what I learned in my own projects."
"Building the example project step-by-step was very helpful."
"Wish there were even more complex practical challenges."
Complex topics broken down effectively.
"The instructor breaks down seemingly complex topics into easy-to-understand pieces."
"I finally understand the target-based approach thanks to this course."
"Everything was explained clearly, making CMake much less intimidating."
"The way they explained linking libraries just clicked for me."
Accessible introduction for new users.
"As someone completely new to CMake, this course was a great starting point."
"It doesn't assume prior knowledge and builds from the ground up."
"Perfect for getting a solid foundation in modern CMake practices."
"Might be a bit slow if you already know the very basics."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Effective Modern CMake: Level Beginner with these activities:
Review C++ Fundamentals
Solidify your understanding of C++ fundamentals, as CMake is often used to build C++ projects. This will make understanding the build process and linking dependencies much easier.
Show steps
  • Review basic syntax and data structures.
  • Practice writing simple C++ programs.
  • Familiarize yourself with object-oriented concepts.
Review 'Professional CMake: A Practical Guide'
Deepen your understanding of CMake by studying a comprehensive guide. This book provides practical examples and best practices.
Show steps
  • Read the chapters relevant to the course syllabus.
  • Try out the examples provided in the book.
  • Take notes on key concepts and best practices.
Practice Writing CMakeLists.txt Files
Reinforce your understanding of CMake syntax and commands by writing CMakeLists.txt files for various simple projects. This will help you become more comfortable with the build system.
Show steps
  • Create a simple C++ project with source files.
  • Write a CMakeLists.txt file to build the project.
  • Build the project using CMake.
  • Experiment with different CMake commands and options.
Four other activities
Expand to see all activities and additional details
Show all seven activities
Create a CMake Cheat Sheet
Consolidate your knowledge by creating a cheat sheet of commonly used CMake commands and syntax. This will serve as a quick reference guide for future projects.
Show steps
  • Identify the most important CMake commands.
  • Summarize the syntax and usage of each command.
  • Organize the cheat sheet for easy reference.
Build a Simple Multiplatform Project with CMake
Apply your knowledge by building a simple multiplatform project using CMake. This will give you hands-on experience with configuring build systems for different operating systems.
Show steps
  • Choose a simple project to build (e.g., a command-line tool).
  • Write the CMakeLists.txt file to support multiple platforms.
  • Test the build on Windows, Linux, and macOS.
  • Address any platform-specific issues that arise.
Read 'CMake Cookbook'
Explore solutions to common CMake problems by reading a cookbook. This book offers recipes for various build system challenges.
Show steps
  • Browse the table of contents for relevant recipes.
  • Study the recipes that address your specific needs.
  • Adapt the recipes to your own projects.
Contribute to a CMake-Based Open Source Project
Deepen your expertise by contributing to an open-source project that uses CMake. This will expose you to real-world CMake configurations and best practices.
Show steps
  • Find an open-source project that uses CMake.
  • Identify a bug or feature to work on.
  • Submit a pull request with your changes.
  • Respond to feedback from the project maintainers.

Career center

Learners who complete Effective Modern CMake: Level Beginner will develop knowledge and skills that may be useful to these careers:
Build Engineer
A Build Engineer focuses on creating and maintaining the software build and release process. This includes automating builds, managing dependencies, and ensuring the stability and reliability of the build system. This course emphasizing modern CMake is directly relevant, as CMake is a widely-used tool for managing the build process, especially for multi-platform projects. Knowing how to use CMake effectively to structure projects, handle dependencies, and manage compiler settings is essential for a build engineer. The course's instruction in CMake basics, creating libraries, and modern CMake project structure is particularly helpful. Someone in this role would also benefit from the material on testing, compiler flags, and optimizing target dependencies.
Software Engineer
Software Engineers design, develop, and maintain software systems. CMake skills are vital for managing the build process in many projects. This course emphasizing Modern CMake specifically helps Software Engineers understand how to effectively use CMake to manage dependencies, configure builds, and ensure cross-platform compatibility. With this course, a Software Engineer learns to avoid common mistakes. This course is valuable because it teaches good build system structure along with understanding the syntax. Skills like creating libraries, working with conditions, and finding packages all contribute to a Software Engineer's competence.
DevOps Engineer
A DevOps Engineer focuses on automating and improving the software development lifecycle, including build processes, testing, and deployment. DevOps Engineers rely on build systems to work reliably. This course on modern CMake helps a DevOps Engineer to understand how to use CMake to manage dependencies, configure builds, and automate the build process. The section on CMake Cache is useful in preventing mistakes. The course provides a strong foundation for automating and optimizing build processes. The material on compiler flags, installing basics, and optimizing target dependencies graph is also relevant.
Release Engineer
Release Engineers are responsible for managing the software release process, ensuring that software is built, tested, and deployed smoothly and reliably. This course emphasizing modern CMake helps Release Engineers to understand how to use CMake to manage the build process, handle dependencies, and configure builds for different platforms. As a result, a release engineer can more easily ensure a smooth release. The course covers the foundations for managing the build process including CMake basics, creating libraries, and target properties. Someone in release management should also pay attention to course material on compiler flags, installing basics, and optimizing target dependencies graph.
Embedded Systems Engineer
Embedded Systems Engineers design, develop, and test software for embedded systems, which often have unique build and deployment requirements. This course emphasizing modern CMake helps Embedded Systems Engineers to understand how to use CMake to manage cross-compilation, target-specific configurations, and dependencies for embedded projects. Embedded systems often have stringent building and configuration requirements, and this course provides a good foundation for handling those requirements. The sections of the course on multiplatform compilers and target properties are also very useful to the Embedded Systems Engineer.
Software Architect
Software Architects design the high-level structure and organization of software systems. Understanding build systems and dependency management is important for making informed architectural decisions. This course emphasizing modern CMake helps Software Architects understand how to use CMake to structure projects, manage dependencies, and ensure maintainability of the build process. The section on CMake basics and structure, as well as target properties, is most relevant. Software architects should be aware of the contents of this course because it illustrates effective project structure, build system cleanliness, and developer-friendliness.
Game Developer
Game Developers create video games for various platforms. Due to the complexity and cross-platform nature of game development, robust build systems like CMake are essential. This course emphasizing modern CMake is helpful for Game Developers to manage dependencies, configure builds for different platforms and compilers, and streamline the build process. The course's coverage of CMake basics, target properties, and cross-platform compilation is particularly useful in ensuring the game can be built and deployed on all target platforms. The course's material on installing, build types, and target properties is particularly helpful.
Robotics Engineer
Robotics Engineers design, develop, and test robots and robotic systems. Robots often rely on complex software, and this course emphasizing modern CMake may be useful for managing the build process, handling dependencies, and configuring builds for different hardware platforms. CMake skills are useful in ensuring that the robot's software can be built and deployed reliably. The course's material on installing, build types, and target properties may be relevant, and would allow Robotics Engineers to use CMake to its full potential.
Simulation Engineer
Simulation Engineers develop and use computer simulations to model and analyze physical systems. These simulations often involve codebases with external dependencies, and this course emphasizing modern CMake may be useful for managing the build process, handling dependencies, and ensuring reproducibility of simulation results. The sections on CMake Cache is useful in preventing mistakes. The course provides a foundation for automating and optimizing build processes. The material on compiler flags, installing basics, and optimizing target dependencies graph may also be relevant to ensuring smooth builds of reliable simulations.
Data Scientist
Data Scientists analyze data to extract insights and develop predictive models. While not always directly involved in software builds, they may use tools and libraries that require compilation. This course emphasizing modern CMake may be useful when Data Scientists need to build custom tools or integrate with C++ libraries. The material on linking to external libraries and finding packages may be particularly relevant. With additional knowledge of CMake, a Data Scientist can build more complex tools for data collection, processing, and machine learning.
Quantitative Analyst
Quantitative Analysts develop and implement mathematical and statistical models for financial analysis and trading. These models often rely on compiled libraries. This course emphasizing modern CMake may be helpful to those Quantitative Analysts who need to build and manage dependencies for their numerical libraries and tools. The material on compiler flags, installing basics, and optimizing target dependencies graph may also be relevant to ensuring smooth builds of reliable financial models.
Research Scientist
Research Scientists conduct experiments and analyze data to advance scientific knowledge, often working with custom software and scientific libraries. This course focusing on CMake may be useful for scientists who need to manage the configuration and build process for their research software. CMake skills are relevant to ensuring that the research software can be built and deployed reliably. The material on linking to external libraries and finding packages may be particularly relevant.
Technical Consultant
Technical Consultants provide expert advice and guidance to organizations on technology-related issues. This course emphasizing modern CMake can help a Technical Consultant better understand build systems and dependency management. The CMake instruction provides the consultant with a framework for advising clients on build system improvements. The consultant can advise on target properties and multiplatform compilation, which may be helpful in ensuring client software can be built and deployed on all target platforms.
Project Manager
Project managers are responsible for planning, executing, and closing projects. While project managers are not always directly involved in software builds, they benefit from understanding technical processes and working together with their technical staff. This course may be useful when Project Managers need to manage projects related to configuration and project builds. The course's material on project structure and refactoring may inform and improve project planning. It can ensure a project manager's better communication with technical staff.
Product Manager
Product managers guide the strategy, roadmap, and feature definition for a product. While they are not typically involved in the technical details of building software, understanding the development process can be beneficial. Project managers may find a course like this helpful by improving their understanding of the complexities involved when generating software for different platforms. This training helps one understand how the product is built and configured. This understanding is vital in order to estimate how to manage product updates and releases.

Reading list

We've selected one books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Effective Modern CMake: Level Beginner.
Comprehensive guide to CMake, covering both basic and advanced topics. It provides practical examples and best practices for using CMake in real-world projects. It is highly recommended as a reference for anyone working with CMake, and will add depth to the material covered in this course. It is commonly used by industry professionals.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Similar courses are unavailable at this time. Please try again later.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2025 OpenCourser