Installing to standard locations

What is a good layout for the installation of your project? As long as you are the only consumer of your project, this question only has limited relevance. However, as soon as you start shipping to the outside world, it will be expected that you provide a sensible layout when installing your project. Fortunately, there are standards that we can adhere to and CMake can help us with that. Effectively, what the GNUInstallDirs.cmake module does is to define a set of variables. These variables are the names of the subdirectories where different types of files should be installed. In our example we used the following:

  • CMAKE_INSTALL_BINDIR: This will give the subdirectory where user executables should be located, ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.