CMAKE_INSTALL_PREFIX
Install directory used by install().
if make install
is invoked or INSTALL
is built, this directory is prepended onto(预先加到) all install directories. This variable defaults to /usr/local
on UNIX and c:/Program Files
on Windows.
On UNIX one can use the DESTDIR
mechanism in order to relocate the whole installation. DESTDIR
means DESTination DIRectory. It is commonly used by makefile users in order to install software at non-default location. It is usually invoked like this:
make DESTDIR=/home/john install
which will install the concerned software using the installation prefix, e.g. /usr/local
prepended with the DESTDIR
value which finally gives /home/john/usr/local
.
WARNING: DESTDIR
may not be used on Windows because installation prefix usually contains a drive letter like in C:/Program Files
which cannot be prepended with some other prefix.
install()
This command generates installation rules for a project. Rules specified by calls to this command within a source directory are executed in order during installation.The order across directories is not defined.
There are multiple signatures for this command. Some of them define installation options for files and targets. Options common to multiple signatures are covered here but they are valid only for signatures that specify them. The common options are:
-
DESTINATION
-
Specify the directory on disk to which a file will be installed. If a full path (with a leading slash or drive letter) is given it is used directly. If a relative path is given it is interpreted relative to the value of the
CMAKE_INSTALL_PREFIX
variable. The prefix can be relocated at install time using theDESTDIR
mechanism explained above.
-
PERMISSIONS
-
Specify permissions for installed files. Valid permissions are
OWNER_READ
,OWNER_WRITE
,OWNER_EXECUTE
,GROUP_READ
,GROUP_WRITE
,GROUP_EXECUTE
,WORLD_READ
,WORLD_WRITE
,WORLD_EXECUTE
,SETUID
, andSETGID
. Permissions that do not make sense on certain platforms are ignored on those platforms.
-
CONFIGURATIONS
- Specify a list of build configurations for which the install rule applies (Debug, Release, etc.).
-
COMPONENT
-
Specify an installation component name with which the install rule is associated, such as “runtime” or “development”. During component-specific installation only install rules associated with the given component name will be executed. During a full installation all components are installed. If
COMPONENT
is not provided a default component “Unspecified” is created. The default component name may be controlled with theCMAKE_INSTALL_DEFAULT_COMPONENT_NAME
variable.
-
RENAME
- Specify a name for an installed file that may be different from the original file. Renaming is allowed only when a single file is installed by the command.
- a