CMAKE_INSTALL_MODEΒΆ
New in version 3.22.
This is a CMake Environment Variable. Its initial value is taken from the calling process environment.
The CMAKE_INSTALL_MODE environment variable allows users to operate
CMake in an alternate mode of file(INSTALL) and install().
The default behavior for an installation is to copy a source file from a source directory into a destination directory. This environment variable however allows the user to override this behavior, causing CMake to create symbolic links instead.
Note
A symbolic link consists of a reference file path rather than contents of its own, hence there are two ways to express the relation, either by a relative or an absolute path.
The following values are allowed for CMAKE_INSTALL_MODE:
empty, unset or
COPY: default behavior, duplicate the file at its destinationABS_SYMLINK: create an absolute symbolic link to the source file at the destination or failABS_SYMLINK_OR_COPY: likeABS_SYMLINKbut silently copy on errorREL_SYMLINK: create an relative symbolic link to the source file at the destination or failREL_SYMLINK_OR_COPY: likeREL_SYMLINKbut silently copy on errorSYMLINK: try as if throughREL_SYMLINKand fall back toABS_SYMLINKif the referenced file cannot be expressed using a relative path. Fail on error.SYMLINK_OR_COPY: likeSYMLINKbut silently copy on error
Installing symbolic links rather than copying files can help conserve storage space because files do not have to be duplicated on disk. However, modifications applied to the source immediately affects the symbolic link and vice versa. Use with caution.
Note
CMAKE_INSTALL_MODE only affects files, not directories.
Note
Symbolic links are not available on all platforms.