[CMake] DEB and RPM Generation?

Eric Noulard eric.noulard at gmail.com
Thu Dec 1 16:13:27 EST 2011


2011/12/1 David Cristian <auledoom at gmail.com>:
> Hello devs!
>
> I've searh the net with no result, i have a project builds various apps and
> libs, i managed to use cmake/cpack to build and create packages for win32
> and debian and i have two questions.
>
> 1 First, it's posibible to build a deb package and rpm simultaneusly from a
> CMAKELists.txt? Can I set more than one generator ?

Yes it is, just set CPACK_GENERATOR
with the list of generator you want:

SET(CPACK_GENERATOR "TGZ;RPM;DEB")

would create TGZ, RPM and DEB.
Note however that:
  - some generator suppose you have some tools installed
    which not be available on the host platform.
    e.g. CPackRPM requires "rpmbuild" command
    which may not be installed on a debian-based distro.

  - building an RPM on debian and installing it on
    Fedora may not work (wrong dependencies or library version etc...).
    It's usually safe to build the package
    on the same kind of host you will be installing it.

  - you may have to set the list of Generator depending
    on the Platform (i.e. RPM Generator is not available on Windows)
    something like:
    if(WIN32)
        set(CPACK_GENERATOR "NSIS;ZIP")
    else()
        set(CPACK_GENERATOR "TGZ;RPM;DEB")
    endif()

> 2. Can I include CPACK multiple times to generate various set of packages
> (myproject.deb, myproject-data.deb, myprojectlibs.deb?

Nope you can't currently do that:
http://public.kitware.com/Bug/view.php?id=10751

Currently you may build several package in the same build if you
use COMPONENT installation:
http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack#Principles_of_CPack_Component_Packaging


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


More information about the CMake mailing list