A quote from the official documentation:
"Specify rules to run at install time."
What exactly is install time?
The problem for me: I am on Linux, software is installed from packages that are just dependencies and data. There is no CMake that can do anything here. So installation time of software is out of scope from CMake. So what exactly do they mean?
Building a CMake project can roughly be divided into three phases:
- Configure time. This includes everything that happens while running
cmake
itself.
- Build time. This includes everything that happens while actually building your project from the files generated by CMake (like, when running
make
).
- Install time. This includes everything that happens when running the
INSTALL
target generated by CMake (like, when running make install
).
Note that the last phase is optional. If you do not want to support calling make install
but prefer another deployment mechanism, you simply don't use the install
command in your CMake script and no INSTALL
target will be generated.
I'd like to expand the answer, which ComicSansMS gave you, a little bit.
As he mentioned - CMake generates an extra target called install
for the make
tool (when you use a Makefile-based generator).
It may look weird for you as a package system is used for Linux. However the install
target is still useful or even necessary:
- When you develop your application you may need to install (move binaries and possibly some include files) to a certain location so some of your projects may see each other. For example, you may develop a library and a set of non-related applications which use it. Then this library must be installed somewhere to be visible. It doesn't mean you need to put it to the
/usr
directory; you may use your /home
.
- The process of Linux package preparation requires an install step. For example, the RPM packaging system does three main steps when the rpm package file is being built: the project is configured, then is compiled and linked and finally is being installed to a certain location. All files from this location are being packed to the rpm file.