[CMake] CPack (RPM) and install()

Eric Noulard eric.noulard at gmail.com
Wed Jun 23 10:41:22 EDT 2010


2010/6/23 Magnus Therning <magnus at therning.org>:
> The documentation for install() is clear, an absolute path (e.g.
> '/usr/lib') is used directly and relative path (e.g. 'lib') is
> prefixed by CMAKE_INSTALL_PREFIX.  Another thing to note is that 'make
> DESTDIR=foo install' *always* works as expected!
>
> However, the relation between install() and CPack is unclear
>
> - For some files I accidentally had an absolute install path, and
> during 'make package' these files got installed in the file system and
> they were left out of the RPM.  I naively assumed that the RPM builder
> would use DESTDIR to control where things end up, but I must be wrong.
>  Is this a bug?

Yes and no.
CPack RPM generator is not different than other generator
it uses DESTDIR iff CPACK_SET_DESTDIR is set to ON.

i.e.
SET(CPACK_SET_DESTDIR ON)

if you want CPack to use DESTDIR.

There is a bug report about that:
http://public.kitware.com/Bug/view.php?id=7000

> - The variable CMAKE_INSTALL_PREFIX is not used at all during RPM
> building.  CMAKE_INSTALL_PREFIX is /usr/local, but files get put into
> /usr in the RPM.  Is this a bug?

It should be using it.
Which version of CMake/CPack are you using.

Could you try:
cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM

and send me the output?

More infos on how to control CPackRPM with CPACK_RPM_xxx vars:
http://www.itk.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
or
cmake --help-module CPackRPM

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list