Building a Reusable Project Skeleton with CMake

Please log in to access your purchased courses.

Embedded systems software developers are faced with a difficult challenge in today’s world: how can we build systems at a high quality with increasingly tight schedules? Our systems are getting more complex, and it always feels like we have less time to build them. We need to find a way to turn the tables on this situation.

At Embedded Artistry, we believe that one solution is to increase the capabilities of embedded systems developers and teams. We can increase everyone’s output quality and productivity by leveraging tools and creating reusable software components. We need to make it easier to do a good job by default.

This course is the second in a series that outlines our approach to increasing your embedded software development capabilities. One way to improve your capabilities is to stop performing repeated tasks over and over again. Never do something twice if you can help it! Setting up a new project and configuring tools falls into the “often repeated” category. These steps are worth optimizing.

Our focus in this course is the creation of a reusable project skeleton. Instead of starting new projects from scratch, using a project skeleton enables us to begin every new project with a fully-functioning build system, commonly used libraries and compilation settings, cross-compilation support, a fully operational set of quality enforcement tools, and ready-to-go continuous integration (CI) rules.

The nominal purpose of having a project skeleton is to improve the setup time for new projects, but it stretches beyond that. Starting from a working base and making sure that the system is always in a working state will keep morale high and help you continue to move your projects forward. We eliminate much of the complexity in setting up a new project, allowing us to focus on development. Quality enforcement tools and CI processes are ready to go, which means we will actually use them instead of putting it off.

The end result is one that all developers are ultimately after: we can increase the quality of our software and deliver projects at a faster rate.

You can take this a step further and automate the deployment of a project skeleton, which enables you to set up new projects and install dependencies on fresh systems with a single command.

Building a Reusable Project Skeleton with CMake

In this course, we guide you through the creation of a reusable CMake-based project skeleton using an existing project as a starting point. You can follow along and build a skeleton using our reference build project, or you can use one of your own projects as the starting point and follow along with our examples.

Note: If you are unfamiliar with CMake, we recommend starting with Creating a Cross-Platform Build System for Embedded Projects with CMake. This course teaches you CMake while creating a build system for a complex, real-world project.

Why do we start with an existing project to create a reusable skeleton, rather than starting from scratch? Because existing projects, especially complex and long-lasting ones, already have complex build setups and tooling integrations. In many cases, these complex setups often showcase creative uses of the build system which we might not think up on our own. We can use the project as inspiration and turn the most useful pieces into reusable modules.

In this course, you will learn the following through a variety of examples and exercises:

  • Transform single-purpose build system code into reusable code
  • Write generic scripts that can be shared across multiple projects
  • Create reusable CMake build modules
  • Provide the ability for your users to configure your CMake build modules

At the end of this course, you will have a fully-functional project skeleton that you can use for new project development.

By doing this work just once, you’ll reap the benefits on every future project that you start.

The goal is for every new project to start with better support and capabilities than the previous project. Try to think of the work you do in terms of components and modules, and ask yourself continually whether you can reuse your work on another project. In this way, we slowly and surely improve our own capabilities over time.

In the next course, Automating the Deployment of a Reusable Project Skeleton, we take our skeleton to the next level by automating the setup process for a new project, as well as automating the installation of dependencies for a new machine that will work with our build system.

Support

We’re here to help you if you get stuck! Our course is designed to be as comprehensive as possible, but also challenging. You can always ask questions or get help in the Course Support section of the forum, through private messages in the course interface, and also through private messages in the forum.

Prerequisites

We do not teach you how to use CMake. If you are not familiar with CMake, we recommend our prerequisite course: Creating a Cross-Platform Build System for Embedded Projects with CMake.
No hardware is required for this course.

Getting Started

Creating the Project Skeleton

CMake: Reusable Build Modules

Expanding the Skeleton

Conclusion

Contains a summary of the course, final downloads, and other supplemental items.

Lessons

Conclusion: Building a Reusable Project Skeleton with CMake