CMake:Install Commands

From KitwarePublic
Revision as of 15:35, 10 June 2007 by LqfD7o (talk | contribs)
Jump to navigationJump to search

cheap diazepam cheap xenical nokia ringtones qwest ringtones zanaflex online diazepam online verizon ringtones free motorola ringtones order lortab prozac online ericsson ringtones but ortho cheap cyclobenzaprine cheap celexa free ringtones phentermine free cool ringtones cheap prozac free qwest ringtones cialis online sprint ringtones nexium online real ringtones sagem ringtones tracfone ringtones free nokia ringtones free punk ringtones mp3 ringtones sony ringtones ativan online but hgh free midi ringtones alltel ringtones cheap flexeril sony ericsson ringtones motorola ringtones vicodin online free tracfone ringtones buy soma levitra online free motorola ringtones cheap didrex cheap sildenafil pharmacy online online zoloft online hydrocodone online free sony ringtones cingular ringtones viagra buy paxil ambien online buy lortab order hydrocodone vigrx online cheap ativan hgh online sildenafil online buy viagra ortho online nextel ringtones lisinopril free funny ringtones free sony ericsson ringtones buy vicodin hydrocodone order ativan mono ringtones clonazepam levitra free sprint ringtones cialis online sony ringtones cheap levitra zanaflex online phentermine celexa online ultracet online wwe ringtones free sharp ringtones buy norco soma online cheap ultracet free cingular ringtones cheap adipex cheap xenical cheap albuterol cheap tenuate cheap ortho free music ringtones sagem ringtones cheap lisinopril meridia online cheap propecia cheap vigrx cheap diethylpropion cheap albuterol mp3 ringtones meridia online free ringtones cheap ultram soma online cheap lortab cheap sildenafil free nextel ringtones cheap lorazepam free funny ringtones diethylpropion online free ringtones funny ringtones cingular ringtones cheap soma nokia ringtones clonazepam online zyban online clomid online buy prozac online valium order lisinopril meridia online buy tramadol sharp ringtones free midi ringtones flexeril online real ringtones celexa online zoloft online free nextel ringtones ericsson ringtones free music ringtones mtv ringtones order ultram buy valium viagra online lorazepam online cheap cialis cheap phentermine buy nexium samsung ringtones cheap norco meridia online sprint ringtones buy rivotril order carisoprodol carisoprodol online cyclobenzaprine online free qwest ringtones free qwest ringtones cheap fioricet verizon ringtones punk ringtones cheap hoodia pharmacy online online tracfone ringtones tramadol cheap rivotril tramadol online didrex online cheap fioricet music ringtones cheap albuterol free nokia ringtones buy viagra buy alprazolam buy xenical pharmacy online online free funny ringtones order zanaflex free ericsson ringtones cyclobenzaprine online adipex online cheap xanax free alltel ringtones free qwest ringtones ultram online sonyericsson ringtones free samsung ringtones cheap lortab free mono ringtones free samsung ringtones zyban online cheap celexa free funny ringtones wwe ringtones cheap rivotril but clomid buy fioricet buy hgh cheap lipitor cheap hoodia clonazepam online cool ringtones tenuate online cheap vicodin real ringtones free sonyericsson ringtones buy hoodia buy tramadol nextel ringtones cheap alprazolam ambien online ==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)

New INSTALL Command

The new INSTALL command replaces all the old commands with a single command. This command is much more flexible and provide a common interface for all installation requirements.

In addition to all the old functionality, this command also provides a way to install directories, run CMake scripts and inline CMake code, as well as a component framework.

Replacing The Old INSTALL_* Commands

Each of the old commands can be replaced with a proper signature of the new INSTALL command.

It is important to note that the new INSTALL command takes all the paths as relative paths. If absolute path is provided, the absolute path will be used.

Replace INSTALL_FILES

Let say that we have files in source and build directory that we are trying to install. These files are: file1.h, file2.h, file3.h, file4.hxx, file5.txt, and file6.cmake. Assume file1.h, file2.h, file4.hxx, and file5.txt are in the source tree, while all the other files are in the build tree.

INSTALL_FILES(/include .h file1.cxx file2.c file3.h)
INSTALL_FILES(/include "\.hxx")
INSTALL_FILES(/share/special_files FILES file5.txt
  ${CMAKE_CURRENT_BINARY_DIR}/file6.cmake)

These lines are replaced with:

INSTALL(FILES file1.h file2.h ${CMAKE_CURRENT_BINARY_DIR}/file3.h
  DESTINATION include)
FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
INSTALL(FILES ${files} DESTINATION include)
INSTALL(FILES file5.txt ${CMAKE_CURRENT_BINARY_DIR}/file6.cmake
  DESTINATION share/special_files)

Replace INSTALL_PROGRAMS

Assuming there are scripts scr1 and scr2, where scr2 is in the build directory. The code in CMake list file would look like this:

INSTALL_PROGRAMS(/bin FILES scr1 ${CMAKE_CURRENT_BINARY_DIR}/scr2)

This line is replaced with:

INSTALL(PROGRAMS scr1 ${CMAKE_CURRENT_BINARY_DIR}/scr2
  DESTINATION bin)

Replace INSTALL_TARGETS

Assuming there are targets: ExecutableTarget, StaticLibraryTarget, and SharedLibraryTarget. Typically there would be code in CMake list file that would look like this:

INSTALL_TARGETS(/bin ExecutableTarget)
INSTALL_TARGETS(/lib StaticLibraryTarget)
INSTALL_TARGETS(/lib RUNTIME_DIRECTORY /bin SharedLibraryTarget)

These lines are replaced with:

INSTALL(TARGETS ExecutableTarget StaticLibraryTarget SharedLibraryTarget
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib
)

RUNTIME refers to the runtime piece of the target. Runtime piece only applies to executable targets and DLL (Winows) style shared libraries. LIBRARY refers to all the other (non DLL) shared libraries and modules. ARCHIVE refers to the static libraries and the import parts of DLL libraries (LIB files).



CMake: [Welcome | Site Map]