[CMake] Problems with CPack RPM

Eric Noulard eric.noulard at gmail.com
Sun Apr 26 17:00:23 EDT 2015


2015-04-25 11:01 GMT+02:00 Markus Mäkelä <markus456 at gmail.com>:

> Hi,
>
> I'm working on a project that uses CMake for build configuration and
> CPack for packaging. We're running on Linux and seem to run into some
> issues with CPack when INSTALL commands have absolute paths.
>
> When we use Makefiles as the build tool, have absolute paths in the
> DESTINATION of the INSTALL command and we are building RPM or DEB
> packages, the make package commands seems to install these files to
> those absolute paths on the system we are doing the packaging on. This
> makes it so that we need to use root to build packages and I'd like to
> avoid this.
>

Installing to absolute destination is always a difficult issue.
When doing this CPack must do some trick to avoid what you observe, i.e.
install the file on the real system.

This issue is independent of the generator (ZIP, RPM, DEB etc...)
The "install" part must set DESTDIR (internally to CPack).
(See CPACK_SET_DESTDIR)

Then depending of each generator some more trick are necessary.
For example CPackRPM tries to monitor those "absoluterly installed files"
in order to flag them as "config files" using %config in order to try
to keep the building of a relocatable RPM.



>
> Is this a bug with how CPack handles RPM and DEB packaging or am I doing
> something wrong? I've managed to somewhat bypass this by doing a lot of
> the absolute path installations in the post-install script but in the
> long run I would like to avoud this.
>

Usually you should ALWAYS use relative install path but for
seldom cases like /etc/whatever-file or the like.

Concering RPM, absolute installed file should work:

try to run

cpack -D CPACK_WARN_ON_ABSOLUTE_INSTALL_DESTINATION=1

and check whether if the log correspond to your absolute installed files

additionnally CPack RPM may spit more verbose output using:
-D CPACK_RPM_PACKAGE_DEBUG=1

Eric

>
> Markus
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150426/56f5d438/attachment.html>


More information about the CMake mailing list