[CMake] Building multiple Debian packages from one source

Eric Noulard eric.noulard at gmail.com
Tue Nov 27 08:17:52 EST 2012


2012/11/27 Patrick Nowak <pa.nowak at tu-bs.de>:
> Hi,
>
> I am currently trying to build more then one Debian package from my sources.
> One package should contain the shared lib and the binary and should simply
> be called projectname-1.0.0.deb and the other one should contain the headers
> and optionally a static lib and should be called projectname-1.0.0-dev.deb.
>
> I found this post (
> http://cmake.3232098.n2.nabble.com/Multiple-Package-Generators-and-add-package-command-td6067405.html),
> possibly describing what to do but it doesn't seem to work for me. I still
> only get one package containing the same stuff it contained before adding
> the COMPONENT statement to my INSTALLs and adding cpack_add_component.

You should enable component packaging for the DEB generator:
set(CPACK_DEB_COMPONENT_INSTALL 1)

see:
cpack --help-variable "CPACK_<GENNAME>_COMPONENT_INSTALL"

for backward compatibility reason some CPack generators (including DEB)
default to "monolithic installer"
http://www.vtk.org/Wiki/CMake:Component_Install_With_CPack#Enabling_Component_Packaging

> Is this approach described in this post the right approach at all for my
> desired goal?

Yes it should work, read the Wiki as well in order to get the big picture.
There is one limitation you won't able to overcome for now is the naming scheme
makes it impossible to have a component package named: "projectname-1.0.0.deb"
you will always get "projectname-1.0.0-<compName>.deb"

see this bug/features request:
http://public.kitware.com/Bug/view.php?id=12997

and the related ones.

> Are cpack_add_component_group and cpack_add_install_type mandatory? How do I
> set the file name for every component respectively package?

Nope.

> If not: Is this even possible with CMake without having to CMakeLists.txt
> files and changing them for every desired package?

I don't understand this?

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org


More information about the CMake mailing list