[CMake] problem with cpack and the using the root directory for packages

Eric Noulard eric.noulard at gmail.com
Thu Jan 29 15:05:16 EST 2009


2009/1/29 Simon Schäfer <Simon.Schaefer at sevenload.com>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi
> I want to pack my files together with cpack. but they should end up to
> have absolute paths or atleast only stripped by the first / within the
> tar ball.
> And the packaging should be done by the user not the root.
>
> If I put the destination to /usr/bin like here:
>
> INSTALL(TARGETS binary RUNTIME DESTINATION /usr/bin)

If you want to use absolute path name for DESTINATION
then you'll need to add:

SET(CPACK_SET_DESTDIR "ON")

to your CMakeLists.txt

however you must know that using absolute pathname is evil
and absolute path name usage may be handled differently
depending on the CPack generator you use (TGZ, ZIP, RPM, DEB, ...)

> it says that the following:
>
> CMake Error at binary/cmake_install.cmake:49 (FILE):
>  file INSTALL cannot copy file
>  ".../binary/binary"
>  to "/usr/bin/binary".
>
> and if i change my install statement to:
>
> INSTALL(TARGETS binary RUNTIME DESTINATION usr/bin)
>
> then the file in the package would look like this:
>
> $ tar tvfz binary.tar.gz
> - -rwxr-xr-x twist/users  307131 2009-01-29 16:53 binary/usr/bin/binary
>
> I figured out that the first part in front of the /usr/bin/binary is
> taken from CPACK_PACKAGE_FILE_NAME put I can not put this to "/" or ""
> because then the filename would be /.tar.gz or ./.tar.gz, not a good way.
>
> Does anyone know how I may change it to "/"

The prefix added by the TGZ cpack generator is specific to TGZ
(e.g. RPM generator won't do that) you may try to have look
at the TGZ generator source code in order to check if it's tunable or not.

More generally you should seek the ML archive for "absolute path and cpack"
you may find several discussion on the subject.



-- 
Erk


More information about the CMake mailing list