

#Cmake install directory structure how to
In the next chapter on packaging, Section 26.2 " Components " covers how components in much more detail, covering how relationships between components can be expressed and how to use that for package generation.įor a more arm-chair coverage of this area, you might also want to watch my CppCon 2019 talk “Deep CMake For Library Authors”. Referring to the 5th edition of my book, Section 25.2 " Installing Targets " explains what components are and gives an example of a typical usage (starting near the bottom of page 324). Some package generators also support a hierarchy of components through grouping, which is how you get things like optional install components in some GUI installers. with the "cmake -install -component " command), or to create multiple packages based around those components.

These can be used to selectively pull in just a subset of available things into a package (e.g. The COMPONENT keyword allows you to group installed things into separate “bags” that you can then use to refer to them later. I wanted to use if for specifying components in the CMake find_package command, but I found it actually isn’t necessary at all and you can simply use careful naming of -config.cmake files. I did a bunch of digging but can’t seem to find what it does. I am trying to understand what the COMPONENT keyword is in the CMake install command. In case anyone else might find this useful I’m including the conversations here so it’s not just for my benefit. After watching excellent talks by both Craig Scott and Deniz Bahadir I reached out to them directly via e-mail and got some very helpful responses.

I recently had a number of questions around the CMake COMPONENT keyword used in the CMake install command and using COMPONENTS in the CMake find_package command.
