[CMake] CPack RPM generator not using CPACK_RPM_<component>_XXX variables

Andrew Helten ahelten at tenable.com
Wed Feb 3 14:22:32 EST 2016


Thanks Domen! The use of original-case for <component> in
CPACK_RPM_<component>_XXXX was indeed the problem. I never did get the
CPACK_RPM_*_PACKAGE_PREFIX variable to work but I'm using a different
(probably more correct) approach that gets me what I wanted.

Can this use of mixed case-sensitive/all-upper-case can be clarified in the
documentation for CPACK_ and CPAC_RPM_ component variables?

Thanks,
Andy

On Tue, Feb 2, 2016 at 2:51 PM, Domen Vrankar <domen.vrankar at gmail.com>
wrote:

> > set(CPACK_GENERATOR "RPM")
> > set(CPACK_RPM_BLAH1_USER_BINARY_SPECFILE
> > "${CMAKE_CURRENT_SOURCE_DIR}/install/SPECS/blah1.spec.in")
> > set(CPACK_RPM_BLAH1_PACKAGE_PREFIX "${CMAKE_INSTALL_PREFIX}/blah1")
> > set(CPACK_RPM_BLAH2_PACKAGE_PREFIX "${CMAKE_INSTALL_PREFIX}/blah2")
> > set(CPACK_RPM_COMPONENT_INSTALL ON)
> > set(CPACK_COMPONENTS_ALL blah1 blah2)
> > include(CPack)
> >
> > What I want this to do is install blah1 in something like /opt/blah1 and
> > install blah2 in /opt/blah2 and use a custom binary spec for component
> > blah1. It does none of these things and instead puts both blah1 and
> blah2 in
> > CPACK_PACKAGING_INSTALL_PREFIX and uses a GENERATED binary spec file for
> > both blah1 and blah2.
>
> This can be done but not all of those features came in at the same
> time so you should check the documentation for the version of
> CMake/CPack you are using.
>
> Also for historical reasons there is a difference between CPack
> variables and CPackRPM specific variables: with CPACK_* variables the
> component part should be in upper case as in your example while with
> CPACK_RPM_* variables the component part should be the same as the
> name of the component (for e.g. in your case
> CPACK_RPM_blah1_PACKAGE_PREFIX).
>
> Also instead of using CPACK_RPM_*_PACKAGE_PREFIX variables you might
> also want to take a look at CPACK_RPM_RELOCATION_PATHS that can be
> used in combination with GNUInstallDirs.cmake script that comes with
> CMake.
>
> e.g.
> include(GNUInstallDirs)
> set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}"
>   "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}")
>
> This way each rpm package can have more than one install prefix location.
>
> Regards,
> Domen
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160203/f1863983/attachment.html>


More information about the CMake mailing list