-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Minimal CMake
By :

When adding install support to a library, everything revolves around the install
command. The install
command is how we tell CMake what to install, as well as the relative layout of files. The good news is there’s very little to change in our existing CMakeLists.txt
files, and in most cases, there’s not a great deal to add either. What we do add though can be quite confusing at first glance, which we’ll try to demystify here.
As with earlier chapters, we’ll work through a concrete example and show how to add install support to the simplest of our existing libraries, mc-array
. This is a static library that provides support for a resizable array in C (very similar to std::vector
in C++). We’ve used this throughout our Game of Life application and it’s a particularly useful utility to rely on.
We’ll start by looking at ch7/part-1/lib/array/CMakeLists.txt
. The first change is we’ve now committed...