What is the installation time for CMake?

Quote from the official documentation :

Msgstr "Specify rules to run during installation."

What is the installation time?

The problem is for me: I'm on Linux, the software is installed from packages that are just dependencies and data. There is no CMake that can do anything here. Thus, software installation time is beyond the scope of CMake. So what exactly do they mean?

+10
source share
2 answers

Building a CMake project can be divided into three stages:

  • Set the time. This includes everything that happens when cmake itself starts. This step involves checking certain properties of the host system and creating specific build files for this platform in the selected configuration.
  • Build time. This includes everything that happens when you actually build your project from the files generated by CMake (for example, when cmake --build or make starts). This is where all the actual compilation and linking happens, so at the end of the build phase you have a usable binary.
  • Installation time. This includes everything that happens when you run the INSTALL target generated by CMake (for example, when you run cmake --build --target install or make install ). This takes care of copying the binaries that were generated in the assembly tree to another directory. Please note that the assembly tree contains many things that are no longer needed after the assembly is completed, if you are only interested in running the binary file. Examples include all intermediate assembly artifacts, such as assembly files created during the setup phase, or intermediate object files created during the assembly phase. In addition, the installation phase may include additional steps to ensure that binaries created during build are portable. For example, on Linux systems, you might want to remove the assembly directory from the search path of the shared library in the binary file and replace it with the portable equivalent. Thus, the installation phase can do more than just copy all the important files to a new directory. It may also include additional steps that modify the binaries to make them more portable.

Please note that the last step is optional. If you do not want to support the make install call but prefer a different deployment mechanism, you simply do not use the install command in your CMake script and the INSTALL target will not be generated.

+5
source

I would like to slightly expand on the answer that ComicSansMS gave you.

As he mentioned, CMake generates an additional target called install for the make tool (when you use the Makefile generator).

This may seem strange to you, since the package system is used for Linux. However, the install target is still useful or even necessary:

  1. When developing an application, you may need to install (move binary files and possibly some include files) to a specific location so that some of your projects can see each other. For example, you can develop a library and a set of unrelated applications that use it. Then this library must be installed somewhere in order to be visible. This does not mean that you need to put it in the /usr directory; You can use your /home .
  2. The Linux package preparation process requires installation. For example, the RPM build system takes three main steps when creating the rpm package file: the project is configured, then compiled and linked, and finally installed in a specific place. All files from this location are packaged into an rpm file.
+2
source

Source: https://habr.com/ru/post/975101/


All Articles