[CMake] Overwiew CMake install commands

Dizzy dizzy at roedu.net
Mon Sep 24 11:45:40 EDT 2007


On Monday 24 September 2007 18:35:21 Joachim Ziegler wrote:
> Hello list,
>
> I just don't get the difference between and when to use the different
> INSTALL commands (or their subcategory in the new INSTALL command,
> resp.) as described on
>
> http://www.cmake.org/Wiki/CMake:Install_Commands
>
> When would I use
>
> - INSTALL_FILES
> - INSTALL_PROGRAMS
> - INSTALL_TARGETS
>
> and what for?
>
> For example, when I give the following rules
>
> ADD_EXECUTABLE(myapp ${SOURCEFILES})
> INSTALL(FILES ${SOURCEFILES} DESTINATION src)
> INSTALL(TARGETS myapp RUNTIME DESTINATION bin)
>
> and the use
>
> $ make package_source

I think you got it wrong. INSTALL() should be used ONLY for installing 
binaries and such (scripts, config files, etc) and not sources. "make 
package_source" ignores the INSTALL() commands and actually tries to pack 
everything in the cmake source directory AFAIK (which is yet another reason 
you should do out of source builds anyways).

> the rule specifying the directory to where the source files go seems to
> be overriden: they go into the top directory. In contrast, in the binary
> package, they go into the src directory.

Yes, that is hardcoded for package_source :)

> So, frankly speaking, I just do not understand the effects of these
> commands. (What is the difference between a TARGET and a PROGRAM and
> what is installed/packaged in the respective case?)

make package uses the INSTALL() commands (as it should since INSTALL() are 
used for installable files, not source files)

make package_source just packs the project source dir I think so be careful 
what you have there...

-- 
Mihai RUSU					Email: dizzy at roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list