Define GNU standard installation directories
Provides install directory variables as defined by the GNU Coding Standards.
Inclusion of this module defines the following variables:
CMAKE_INSTALL_<dir>
DESTINATION options of install() commands for the corresponding file type. CMAKE_INSTALL_FULL_<dir>
CMAKE_INSTALL_<dir> value. If the value is not already an absolute path, an absolute path is constructed typically by prepending the value of the CMAKE_INSTALL_PREFIX variable. However, there are some special cases as documented below. where <dir> is one of:
BINDIR bin)SBINDIR sbin)LIBEXECDIR libexec)SYSCONFDIR etc)SHAREDSTATEDIR com)LOCALSTATEDIR var)RUNSTATEDIR LOCALSTATEDIR/run)LIBDIR lib or lib64 or lib/<multiarch-tuple> on Debian)INCLUDEDIR include)OLDINCLUDEDIR /usr/include)DATAROOTDIR share)DATADIR DATAROOTDIR)INFODIR DATAROOTDIR/info)LOCALEDIR DATAROOTDIR/locale)MANDIR DATAROOTDIR/man)DOCDIR DATAROOTDIR/doc/PROJECT_NAME)If the includer does not define a value the above-shown default will be used and the value will appear in the cache for editing by the user.
The following values of CMAKE_INSTALL_PREFIX are special:
/
For <dir> other than the SYSCONFDIR, LOCALSTATEDIR and RUNSTATEDIR, the value of CMAKE_INSTALL_<dir> is prefixed with usr/ if it is not user-specified as an absolute path. For example, the INCLUDEDIR value include becomes usr/include. This is required by the GNU Coding Standards, which state:
/usr will be a symbolic link to /. /usr
<dir> equal to SYSCONFDIR, LOCALSTATEDIR or RUNSTATEDIR, the CMAKE_INSTALL_FULL_<dir> is computed by prepending just / to the value of CMAKE_INSTALL_<dir> if it is not user-specified as an absolute path. For example, the SYSCONFDIR value etc becomes /etc. This is required by the GNU Coding Standards. /opt/...
<dir> equal to SYSCONFDIR, LOCALSTATEDIR or RUNSTATEDIR, the CMAKE_INSTALL_FULL_<dir> is computed by appending the prefix to the value of CMAKE_INSTALL_<dir> if it is not user-specified as an absolute path. For example, the SYSCONFDIR value etc becomes /etc/opt/.... This is defined by the Filesystem Hierarchy Standard. GNUInstallDirs_get_absolute_install_dir GNUInstallDirs_get_absolute_install_dir(absvar var)
Set the given variable absvar to the absolute path contained within the variable var. This is to allow the computation of an absolute path, accounting for all the special cases documented above. While this macro is used to compute the various CMAKE_INSTALL_FULL_<dir> variables, it is exposed publicly to allow users who create additional path variables to also compute absolute paths where necessary, using the same logic.
© 2000–2018 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
https://cmake.org/cmake/help/v3.12/module/GNUInstallDirs.html