Search⌘ K
AI Features

Low-Level Installation

Explore how to use CMake's install(FILES) and install(PROGRAMS) commands to manage the installation of headers, scripts, and assets. Understand the difference in file permissions, how to specify destinations with TYPE or DESTINATION, and techniques to organize installed files for effective project packaging.

Modern CMake is moving away from the concept of manipulating files directly. Ideally, we'd always add them to a logical target and use that as a higher level of abstraction to represent all the underlying assets: source files, headers, resources, configuration, and so on. The main advantage is the dryness of the code: usually, we won't need to change more than one line to add a file to the target.

Unfortunately, adding every installed file to a target isn't always possible or convenient. For such cases, three choices are available:

  • install(FILES)

  • install(PROGRAMS)

  • install(DIRECTORY) ... ...