[CMake] CPack RPM with COMPONENTS packaging

Eric Noulard eric.noulard at gmail.com
Tue Mar 19 11:06:13 EDT 2013


2013/3/19 Theodore Papadopoulo <Theodore.Papadopoulo at inria.fr>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>         Hi,
>
> I cannot manage to make COMPONENT packaging with RPM to work.
> I clearly see that the CPackRPM.cmake module contains stuff to do so,
> but I cannot manage to make it work at all.
>
> Even the ComponentExampleStart that is given on some of CMake wiki
> page does not work for me and always generates a single package. Am I
> missing something ?

Yes.
For backward compatibility reason component packaging is not the default
behavior for most CPack generator (but NSIS).
See:
cpack --help-variable "CPACK_<GENNAME>_COMPONENT_INSTALL"

  CPACK_<GENNAME>_COMPONENT_INSTALL
       Enable/Disable component install for CPack generator <GENNAME>.

       Each CPack Generator (RPM, DEB, ARCHIVE, NSIS, DMG, etc...) has a
       legacy default behavior.  e.g.  RPM builds monolithic whereas NSIS
       builds component.  One can change the default behavior by setting this
       variable to 0/1 or OFF/ON.


You have to enable it in you CMakeLists.txt or on the command line:
So for RPM:

cpack -D CPACK_RPM_COMPONENT_INSTALL=1 -G RPM


> If the support is not yet here, what is the best path to obtain this.

It is there but incomplete as the list of pending bugs/features
request can show,
see e.g.:
http://public.kitware.com/Bug/view.php?id=13176
http://public.kitware.com/Bug/view.php?id=12997
and related ones.

> I can easily provide a spec file, but I would at least wish that the
> files corresponding to the components be configured. How can I get them.

Try what is already working and see if it already suits your needs.
If not browse the pending bugs in order to see if any of them is related
to your specific need.
Then ask question here on the concerned bug and you'll certainly get
specific answer.

> And I cannot even see a clean way to provide CPackRPM with my own
> template.

You can use CPACK_RPM_USER_BINARY_SPECFILE in order to provide your template
(see cpack --help-variable CPACK_RPM_USER_BINARY_SPECFILE)

but the spec file used by CPackRPM is a "short-cutted" one.

So that you first need to use:
CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
in order to generate a template CPackRPM can handle then modify it
and use CPACK_RPM_USER_BINARY_SPECFILE.

> Any help will be appreciated.

Hope this helps.

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list