[CMake] How to pack a target/file into multiple packages in Linux?

Eric Noulard eric.noulard at gmail.com
Fri Nov 2 04:56:39 EDT 2012


2012/11/2 Ralph Zhang <ralph.j.zhang at gmail.com>:
> Hi guys
>
> I'm working on a project which generates quite a few executables, libraries
> and configs, they need to be packed into different packages for deployment.
> The problem is, the inclusion of those targets/files is not mutual
> exclusive. One target/file can belong to multiple packages.
>
> I'm using CMake 2.8.9 and trying CPack.

Which cpack generator are you targeting? NSIS, PackageMaker, RPM, DEB, ZIP?

> I know it's kind of doable with
> install types. But my platform is Ubuntu, so on Archives/Debs are acceptable
> and they don't seem to support that.
>
> With components/groups/parent groups it seems only possible to pack one
> target/file into one component/group.
>
> Is there any way out of this?

I bet that currently you'll have to run cpack as many time as you have packages.

1) Define the components that you need

2) Define CPACK_INSTALL_CMAKE_PROJECTS (and possibly other CPACK_xxx)
    variables when launching CPack (could be done using a custom command)
    Using this var you can decide which component will be installed so
that you can
    include/exclude component.
    You may override "CPACK_COMPONENTS_ALL" as well.

    this can be done on the command line
    cpack -D CPACK_INSTALL_CMAKE_PROJECTS="..."

    or from within a CPACK_PROJECT_CONFIG_FILE.

more info:
cpack --help-variable CPACK_COMPONENTS_ALL
cpack --help-variable CPACK_INSTALL_CMAKE_PROJECTS
cpack --help-variable CPACK_PROJECT_CONFIG_FILE


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


More information about the CMake mailing list