MantisBT - CMake
View Issue Details
0010736CMakeCPackpublic2010-05-20 07:102010-10-06 14:40
Stefan Sablatnoeg 
CMake 2.8.3CMake 2.8.3 
0010736: Enable CPack generators to produce more than one package
It would be nice if it would be possible to build multiple packages from one cmake project using cpack. Especially for the "simple" generators like ZIP etc. a seperation based on the COMPONENT given in the install command woould be very helpful (and probably easy to implement), but even for "active installers" there might be the need to provide different modules from one source tree.

No tags attached.
related to 0009900closed Eric NOULARD Make CPack generic generator delegate the name of the file to specific generator 
parent of 0007645closed Eric NOULARD Add support of CPack Component to CPack RPM generator 
related to 0010130closed Eric NOULARD cpack components for non-component generators 
patch 0001-CPack-enable-generators-to-produce-more-than-one-pac.patch (22,505) 2010-08-03 20:18
patch 0002-CPack-enable-generators-to-produce-more-than-one-pac.patch (4,554) 2010-08-03 20:18
patch 0003-CPack-enable-generators-to-produce-more-than-one-pac.patch (12,085) 2010-08-03 20:18
patch 0004-CPack-enable-generators-to-produce-more-than-one-pac.patch (11,474) 2010-08-04 10:08
patch 0005-CPack-enable-generators-to-produce-more-than-one-pac.patch (5,469) 2010-08-05 18:30
patch 0001-CPackArchiveGenerator-use-cmArchiveWrite-wrapper.patch (12,927) 2010-08-21 07:44
patch 0002-CPackArchiveGenerator-add-component-supports.patch (13,331) 2010-08-21 07:44
patch 0003-CPackArchiveGenerator-improve-usability-and-robustne.patch (3,354) 2010-08-22 12:21
Issue History
2010-05-20 07:10Stefan SablatnoegNew Issue
2010-05-20 08:14Bill HoffmanNote Added: 0020798
2010-05-20 13:36Eric NOULARDNote Added: 0020804
2010-05-20 13:36Eric NOULARDRelationship addedrelated to 0009900
2010-05-20 13:36Eric NOULARDRelationship addedparent of 0007645
2010-08-02 07:15Eric NOULARDStatusnew => assigned
2010-08-02 07:15Eric NOULARDAssigned To => Eric NOULARD
2010-08-02 07:21Eric NOULARDFile Added: 0001-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-02 07:24Eric NOULARDNote Added: 0021592
2010-08-02 19:03Eric NOULARDRelationship addedrelated to 0010130
2010-08-03 03:04Stefan SablatnoegNote Added: 0021601
2010-08-03 20:18Eric NOULARDFile Deleted: 0001-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-03 20:18Eric NOULARDFile Added: 0001-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-03 20:18Eric NOULARDFile Added: 0002-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-03 20:18Eric NOULARDFile Added: 0003-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-03 20:23Eric NOULARDNote Added: 0021621
2010-08-04 10:08Eric NOULARDFile Added: 0004-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-04 10:09Eric NOULARDNote Added: 0021632
2010-08-04 12:28Eric NOULARDNote Added: 0021637
2010-08-05 18:30Eric NOULARDFile Added: 0005-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-08 13:09harmyNote Added: 0021692
2010-08-08 14:08Eric NOULARDNote Added: 0021696
2010-08-21 07:44Eric NOULARDFile Added: 0001-CPackArchiveGenerator-use-cmArchiveWrite-wrapper.patch
2010-08-21 07:44Eric NOULARDFile Added: 0002-CPackArchiveGenerator-add-component-supports.patch
2010-08-21 07:54Eric NOULARDNote Added: 0021869
2010-08-22 12:21Eric NOULARDFile Added: 0003-CPackArchiveGenerator-improve-usability-and-robustne.patch
2010-08-24 16:37Eric NOULARDNote Added: 0021933
2010-08-31 16:37Eric NOULARDNote Added: 0022037
2010-08-31 16:37Eric NOULARDStatusassigned => closed
2010-08-31 16:37Eric NOULARDResolutionopen => fixed
2010-08-31 16:37Eric NOULARDFixed in Version => CMake-2-8
2010-08-31 18:03David ColeTarget Version => CMake 2.8.3
2010-10-06 14:40David ColeFixed in VersionCMake-2-8 => CMake 2.8.3

Bill Hoffman   
2010-05-20 08:14   
Is this what you are looking for: [^]
2010-05-20 13:36   
To Bill:
Currently there is only two CPack generators that supports components:
NSIS and PackageMaker.

This is pending for a long time for RPM because:
   - lack of time (as usual)
   - because generic generator was not meant to support
     "several files" generation in the first place
     see there [^]

I'll add relationship with those related bugs / features requests
2010-08-02 07:24   
Hi All,

Here comes a patch which provides the necessary changes to
all CPack Generators for supporting the requested features.

The patch contains changes to the Archive Generators which will
produce a set of files for a componentized project.
For example using the example from [^]
using the ZIP generator it produces:

$ cpack -G ZIP
CPack: Create package using ZIP
CPack: Install projects
CPack: - Run preinstall target for: MyLib
CPack: - Install project: MyLib
CPack: - Install component: applications
CPack: - Install component: libraries
CPack: - Install component: headers
CPack: Compress package
CPack: Finalize package
CPack: Created package:
CPack: Created package:
CPack: Created package:

Waiting for feedback before going on...
Stefan Sablatnoeg   
2010-08-03 03:04   
Hi all,
first of all many thanks for providing a patch.
I tried it on an small example yesterday and it worked as expected
(I patched against cmake 2.8.2), a larger test will follow as soon as I
find the time.

One minor thing (maybe a different issue?),
I am not quite sure of yet is how to handle the destination
of the packages? Is there already way to produce (or copy) the packages
to a user defined place (we usually put our final deliveries under revision
control, so it would be ideal if the package would be in the "right" place
automatically after each build.)
2010-08-03 20:23   
Updated patch set.

0001 and 0002 contains the change of API for compressFile
0003 contains the updated ArchiveGenerator(s) for handling
     the 1 component == 1 package case.

A next patch should enable the
         1 component group == 1 package case.

Could someone test those patches (at least 0001 and 0002)
on Windows and/or OS X, I won't be able to test on those platforms.

Unless someone has more remarks concerning the change of API
I think 0001 and 0002 may be applied now to next/master.
2010-08-04 10:09   
Adding 0004 patch to patchset.
With 0004 the Archive Generators will produce 1 package file per component group
unless there is no group or CPACK_COMPONENT_IGNORE_COMPONENT_GROUP=1
is specified.
2010-08-04 12:28   
Small note:

The patch series are cumulative.
One must apply 0001 before 0002 etc...
Applying all those patches using git should be as simple as

git apply 000?-CPack-enable-generators-to-produce-more-than-one-pac.patch
2010-08-08 13:09   
hi, Eric:
thanks for your patches,can you post a sixth patch that makes CPackDebGenerator work?
2010-08-08 14:08   
Hi Harmy,

I will certainly work on a multi-package for DEB and RPM
but there are some overlapping change going on
(related to bug [^])
so I may have to stall this in order to avoid to "double"
the work.

So the short answer is: Yes I will but not now.
You can monitor this bug and you will be kept informed.

Thank you for your interest in this.
2010-08-21 07:54   
Here comes a new set of patches for Archive Generators (ZIP, TGZ, STGZ etc...)

the previous work has been rebased on the redesigned CPack API.

The patches may be applied starting from current master.
you may pull the same content from my github branch: [^]

I think this can now go in upstream CMake and I will ask for this.
A usual I'm not able to test on Windows or MacOS so testers are welcomed.

I will send more "user" information on CMake ML.
Basically the patch introduces 3 new variables:


which may set at CPack time in order to chose how
many package files are generated and how the "grouping"
takes place.

The default behavior is to create 1 package for each component group.
2010-08-24 16:37   
latest patch proposal have been pushed to next
2010-08-31 16:37   
Merged to master:

commit 65fa0f02351e1564d60b266594b425094dce1959
Merge: f95074b a986daf
Author: Brad King <>
Date: Tue Aug 31 14:24:32 2010 -0400

    Merge topic 'CPackArchiveGenerator-ComponentSupport'
    a986daf CPack fix broken compilation for CygwinSource generator
    873e99a CPackArchiveGenerator improve usability and robustness
    654683a CPackArchiveGenerator add component supports
    36a550a CPackArchiveGenerator use cmArchiveWrite wrapper