Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the CMake install time?

Tags:

cmake

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?

like image 800
Arne Avatar asked Sep 11 '14 01:09

Arne


People also ask

How do I know if CMake is installed?

You can check your CMake version by using the command cmake --version. cmake version 3.11. 2CMake suite maintained and supported by Kitware (kitware.com/cmake).

What does CMake install do?

CMake provides the install command to specify how a project is to be installed. This command is invoked by a project in the CMakeLists file and tells CMake how to generate installation scripts. The scripts are executed at install time to perform the actual installation of files.

Where is CMake usually installed?

The installation directory is usually left at its default, which is /usr/local . Installing software here ensures that it is automatically available to users. It is possible to specify a different installation directory by adding -DCMAKE_INSTALL_PREFIX=/path/to/install/dir to the CMake command line.

Do you need to install CMake?

In order to build CMake from a source tree on Windows, you must first install the latest binary version of CMake because it is used for building the source tree.


1 Answers

Building a CMake project can roughly be divided into three phases:

  • Configure time. This includes everything that happens while running cmake itself. This phase is concerned with inspecting certain properties of the host system and generating the specific build files for that platform under the selected configuration.
  • Build time. This includes everything that happens while actually building your project from the files generated by CMake (like, when running cmake --build or make). This is where all of the actual compilation and linking happens, so at the end of the build phase, you have a usable binary.
  • Install time. This includes everything that happens when running the INSTALL target generated by CMake (like, when running cmake --build --target install or make install). This takes care of copying the binaries that were generated into the build tree to a different directory. Note that the build tree contains a lot of stuff that is no longer needed once the build is completed if you are only interested in running the binary. Examples include all intermediate build artifacts, like the build files generated during the configure phase or the intermediate object files created during the build phase. Furthermore, the install phase might include additional steps to ensure that the binaries produced during the build are portable. For instance, on Linux systems you might want to remove the build directory from the shared library search path in the binary and replace it with a portable equivalent. So the install phase might do more than just copy all the important files to a new directory. It could also include additional steps that change the binaries to make them more portable.

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.

like image 144
ComicSansMS Avatar answered Dec 02 '22 12:12

ComicSansMS