[CMake] Generating multiple debian packages

Doug douglas.linder at gmail.com
Wed Aug 8 23:27:24 EDT 2012


I've update my example code here to do this; it results in much easier
to configure individual packages than trying to force the components
(never designed for independent packages from one project), and is
extendable to support other generators that do not support components.

https://github.com/shadowmint/cmake-multi-install

~
Doug.

On Thu, Aug 9, 2012 at 10:06 AM, Doug <douglas.linder at gmail.com> wrote:
> Woops; didn't mean to respond off list.
>
> Anyway, basically my suggestion is as part of your build generate a folder like:
>
> ${CMAKE_CURRENT_BINARY_DIR}/deploy-package-XXX/
>
> And copy all the file you want to deploy as part of your package into
> that directory.
> Then generate a CMakeLists.txt file with only cpack directives in it
> into that directory.
> Finally invoke cmake as a post build custom command in that directory
> to build the package.
>
> cpack does not support configuration per component for debian packages
> (and some other generators).
> Even if you split your code up into multiple packages, they'll end up
> with the same description, etc.
>
> It's also worth noting that on old systems (ubuntu 8 LTS for example)
> the debian packages generated by
> cpack are NOT VALID and will fail to install in some circumstances
> (the order of files in the archive is
> not correctly set, and it will try to install files before the
> relevant directories have been created, failing the
> install). Doesn't seem to be an issue in more recent versions though.
>
> ~
> Doug.
>
> On Thu, Aug 9, 2012 at 9:51 AM, Bruce Cartland <bruce.cartland at pobox.com> wrote:
>>
>> I've been through this and experimented with samples kindly provided by
>> another user. Nothing works for debian packaging. What I think will work is
>> a "workaround" from another user in 2008
>> http://www.cmake.org/pipermail/cmake/2008-April/020967.html, where I
>> generate my own CPackConfig-runtime.cmake and CPackConfig-dev.cmake files.
>>
>> thanks for the pointers
>>
>> On 8/08/2012 5:50 PM, Eric Noulard wrote:
>>
>>
>> s.
>>
>> 2012/8/8 m.hergarden <m.hergarden at euphoria-it.nl>
>>>
>>> I have found this to work for RPM files:
>>>
>>> You have to define components using:
>>> cpack_add_component(runtime DISPLAY_NAME runtime REQUIRED INSTALL_TYPES
>>> all)
>>
>>
>> You are right defining components is the easiest way to produce several
>> packages (deb, rpm, zip, etc...)
>> This is explained here:
>> http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack
>>
>>>
>>>
>>> For rpm I had to set this:
>>> SET(CPACK_RPM_COMPONENT_INSTALL     "ON"
>>> (Grepping on component in the CPackDeb.cmake module suggests the deb files
>>> use something similar.)
>>
>>
>> This fact is explained as well:
>> http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack#Enabling_Component_Packaging
>>
>> Beginning with CPack/CMake 2.8.8 you can get the list of CPACK_xxx control
>> variables:
>>
>> cpack --help-variable-list
>>
>> and
>> cpack --help-variable "CPACK_<GENNAME>_COMPONENT_INSTALL"
>>
>> gives you the specific documentation:
>>
>>   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.
>>
>>>
>>>
>>> In your INSTALL() statements you have to add 'COMPONENT runtime' to
>>> specify the component a file belongs to.
>>>
>>> Hth,
>>> Micha
>>>
>>>
>>> On 08/08/2012 08:59 AM, Bruce wrote:
>>>
>>> Hi
>>>
>>> Got my shiny new cmake build system going for my project on windows,
>>> Ubuntu, and Mac.
>>>
>>> Despite a fair bit of research I'm still not sure how to generate 2
>>> separate debian packages from the same cmake files - say myapp.deb and
>>> myapp-dev.deb.
>>
>>  Concerning the naming scheme of the various packages, there are some
>> limitations:
>> see: http://public.kitware.com/Bug/view.php?id=12997
>> and related bugs.
>>
>>
>> --
>> Erk
>> Le gouvernement représentatif n'est pas la démocratie --
>> http://www.le-message.org
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list