CMake:Install Commands

From KitwarePublic
Revision as of 14:25, 3 October 2006 by Andy (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Overview

CMake has an elaborate install process that simplifies installation of programs, libraries, and other files. In CMake version 2.4 the new INSTALL command was introduced that encompasses the functionality of all the old install commands. This page describes the new INSTALL command and the transition from the old one.

Old Install Commands

INSTALL_FILES
Create rules to install the listed files with the given extension into the given directory. Only files existing in the current source tree or its corresponding location in the binary tree may be listed. If a file specified already has an extension, that extension will be removed first. This is useful for providing lists of source files such as foo.cxx when you want the corresponding foo.h to be installed. A typical extension is '.h'.
INSTALL_FILES(<dir> extension file file ...)
INSTALL_FILES(<dir> regexp)
Any files in the current source directory that match the regular expression will be installed.
INSTALL_FILES(<dir> FILES file file ...)
Any files listed after the FILES keyword will be installed explicitly from the names given. Full paths are allowed in this form. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX.
INSTALL_PROGRAMS
Create rules to install the listed programs into the given directory. Use the FILES argument to guarantee that the file list version of the command will be used even when there is only one argument.
INSTALL_PROGRAMS(<dir> file1 file2 [file3 ...])
INSTALL_PROGRAMS(<dir> FILES file1 [file2 ...])
INSTALL_PROGRAMS(<dir> regexp)
In the third form any program in the current source directory that matches the regular expression will be installed. This command is intended to install programs that are not built by cmake, such as shell scripts. See the TARGETS form of the INSTALL command to create installation rules for targets built by cmake. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX.


INSTALL_TARGETS
Create rules to install the listed targets into the given directory. The directory <dir> is relative to the installation prefix, which is stored in the variable CMAKE_INSTALL_PREFIX. If RUNTIME_DIRECTORY is specified, then on systems with special runtime files (Windows DLL), the files will be copied to that directory.
INSTALL_TARGETS(<dir> [RUNTIME_DIRECTORY dir] target target)