[CMake] Install multiple components using CPack
Mark Stijnman
mark.stijnman at gmail.com
Mon Nov 11 08:49:47 EST 2013
On Tue, Nov 5, 2013 at 12:11 PM, Alexander Broekhuis
<a.broekhuis at gmail.com> wrote:
> Hi all,
>
> I have a CMake project for which I want to generate a RPM and/or ZIP file.
> But instead of including all components/groups I want to control this.
>
> I do know I can create a CPack configuration file to create a package for 1
> component using CPACK_INSTALL_CMAKE_PROJECTS, how can I do this for a
> component_group?
>
> For example, I have a component group called "bundles", and also several
> components (eg "a" and "b"). Both "a" and "b" are added to the group
> "bundles". How can I now create one CPack configuration so that I have one
> package containing all bundles?
>
> --
> Thanks in advance,
>
> Alexander Broekhuis
>
The easiest way I know is to use CPACK_COMPONENTS_ALL, which is what I
use to package subsets of my components.
I don't currently use grouping, but if I would, I would create
something like an add_component_to_group(compname, groupname)
function, that you can call for every component when you first define
it (or add a GROUP parameter it to my define_package_component()
function). In addition to setting
PACK_COMPONENT_${compname_uppercase}_GROUP to ${groupname}, it should
append ${compname} to a (global) package_group_${groupname}_components
list variable. Then populate the CPACK_COMPONENTS_ALL list by
iterating over your list of required groups, and for each group name,
append ${package_group_${groupname}_components}.
Hope that gives you some ideas to start from,
regards Mark
More information about the CMake
mailing list