[CMake] CPack and building installers for sub-projects

Eric Noulard eric.noulard at gmail.com
Fri Apr 1 14:52:23 EDT 2011


2011/4/1 Clinton Stimpson <clinton at elemtech.com>:
> On Friday, April 01, 2011 12:38:25 pm Eric Noulard wrote:
>> 2011/4/1 Crni Gorac <cgorac at gmail.com>:
>> > Am working with seemingly not too complicated CMake setup: Have two
>> > projects, say Foo and Bar, both dependent from the library libBaz;
>> > actually at the beginning there was only Foo project, and now there is
>> > Bar project, and common code is refactored into libBaz library.  All
>> > three of these are into own subdirectories, and I have top-level
>> > CMakeLists.txt, that practically contains only references to each of
>> > these subdirectories.  The libBaz library is built statically and
>> > linked this way into both Foo and Bar projects, so it all works in
>> > rather simple manner.  However, now I'm faced with creating CPack
>> > installers for both Foo and Baz - more precisely, there already exists
>> > CPack based installer for Foo that also works great, and now I'm
>> > looking into building same kind of installer for Bar.  I've looked
>> > through the list and such, but it seems that it is not possible to
>> > have two installers generated from single CMake source tree.  So -
>> > what would be recommended approach to handle this sort of setup then?
>>
>> Which version of CMake are you using?
>> Which set of CPack generator do you want to work with?
>>
>> Multiple installer on the same tree is not really handled yet unless
>> you use multi-file component-aware installers
>> (ZIP, TGZ and other archive generators, RPM and DEB).
>>
>> You can find more information about that here
>> http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack
>>
>> Now you scheme is more like the feature request described here:
>> http://public.kitware.com/Bug/view.php?id=11808
>>
>> Have a look at that this thread too:
>> http://www.cmake.org/pipermail/cmake/2011-February/043075.html
>>
>> So basically CPack does not currently support multi-package besides
>> the component things. If you want to join the effort to make it happen
>> please do so by throwing idea (on the mailing list or tracker)
>> and/or patch on the bug tracker.
>
> I've been doing this with multiple CPack config files.  You can either make them
> by hand or use CPack.cmake multiple times to make those config files for you.
> Then when you run cpack, you give it the config file to use when making a
> package.

Clinton is right, the hand-crafted multiple CPack config files works.

However, keep in mind that CPack.cmake wasn't initially
meant to be included several times so it sometimes leads to strange behavior:
http://public.kitware.com/Bug/view.php?id=10751

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list