![]() ![]() ![]() Having said all that, CMake does work and achieves its purpose for creating a cross-platform build system that will generate build files that optimise the compilation steps. It was difficult for us to access information that helped us understand how CMake works: specifically an overall understanding of how to configure a cross-compilation project. While CMake has extensive documentation, it is very much a guide to what (descriptions of function and variables) that lacks the how (examples) and the why. ![]() This has added to the confusion over using CMake because there are many resources on the web that refer to the legacy style of CMake. CMake tries hard to hide these differences but doesn’t always succeed.ĬMake was originally developed in 1999, but the release of version 3.0 in 2014 introduced a new style of defining a project which is generally referred to as Modern CMake. Make, on the other hand, is command-line based and does not support different build configurations. At a fundamental level both Visual Studio and Xcode provide a GUI environment that supports multiple build configurations such as Debug and Release. This plethora of different build systems adds to the confusion about using CMake. The following schematic overview shows the complexity of building a modern software system with multiple inputs and output artefacts which will help explain why we need to use a build system to manage the process.ĬMake supports several hosted build systems such as GNU Make,(Linux), Visual Studio (Microsoft Windows), Xcode (OSX) and Ninja (multiple platforms) as well as cross-compilation systems such as Android Studio and IAR Workbench. For larger projects this can reduce build times down from tens of minutes or hours, to a few minutes, perhaps even less than one minute. Its purpose is to take your description of a project and generate a set of configuration files to build that project.Īs part of the generation of build configuration files CMake also analyses source code to create a dependency graph of components so that when building the project unnecessary recompilation steps can be omitted to reduce build times. What is CMakeĬMake is not a build system like Unix Make but a build system generator. The code and examples used in this blog are from CMake 3.16 on Ubuntu 20.04 LTS using the GNU Arm Embedded Toolchain and can be download from the GitHub project. It is the first of a small series of posts looking at how we build our training projects comprising application code, supporting library code, real-time operating system and bare metal driver code. This blog post is a mix of musings and advice when using CMake for cross-compiling to the STM STM32F407 Discovery board that we use for our embedded C and C++ training. For this reason, we’ve put aside our prejudices and reconsidered the way we build our example projects used during training by replacing scons with CMake. Here at Feabhas, we find ourselves falling in the latter category, despite the fact the CMake is widely used within the embedded and deeply embedded development community.īut we also know that many of the C/C++ static analysis and code quality tools integrate well with the CMake build system. In this post we will examine how to use CMake to mange the build process for a cross compilation project.ĬMake can be described as a marmite application: you either love it or hate it. In our previous post Why We Need Build Systems we examined the need for Build Systems in modern software development. For example, to generate Ninja build files we would use: Should we want to use a different build system instead of the host default (GNU Make for Linux) we need to tell CMake which build generator to use using the -G command option. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |