[CMake] Using CPack to create multiple packages

Raphael Cotty raphael.cotty at googlemail.com
Thu Jan 17 04:47:25 EST 2008


Hi,
I use use CPack to generate multiple packages (abusing COMPONENT).
My project dirs are like that:
Libs/
ProjectA/
ProjectB/

ProjectA and B need the libs from Libs. So when I create a package for
ProjectA / ProjectB I need the packaging to include libs from Libs.
So in Libs/CMakeLists.txt:
INSTALL(
    PROGRAMS ${LIBRARY_OUTPUT_PATH}/libLibs.so
    DESTINATION "usr/lib"
    COMPONENT "Libs"
    )
In my ProjectA/CMakeLists.txt:
# To allow different CPackConfig.cmake files (not over-written by another
project
SET( CPACK_OUTPUT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CPackConfig.cmake" )
INSTALL(
        PROGRAMS ${EXECUTABLE_OUTPUT_PATH}/ProjectsA
        DESTINATION "usr/bin"
        COMPONENT "ProjectA"
        )
And in my CMakeLists.txt:
ADD_CUSTOM_TARGET(
    packageProjectA
    COMMAND cmake -E remove_directory ${CMAKE_INSTALL_PREFIX}
    COMMAND cmake -DCOMPONENT="ProjectA" -P cmake_install.cmake
    COMMAND cmake -DCOMPONENT="Libs" -P cmake_install.cmake
    COMMAND cpack --config
${PROJECT_BUILD_DIR}/GasSensorController/CPackConfig.cmake
    )

That's very dirty but works for me.
Raph


On Jan 17, 2008 7:35 AM, Eric Noulard <eric.noulard at gmail.com> wrote:

> 2008/1/16, Filipe Sousa <natros at gmail.com>:
> > Ted Berg wrote:
> > > Filipe Sousa wrote:
> > >
> > > I aplogize, my initial post wasn't terribly clear.  I'm currently
> > > generating, for example, the following packages:
> > >
> > > foo-sdk-1.0.0.zip
> > > foo-qa-tools-1.0.0.zip
> > > foo-killer-app-1.0.0.zip
> > >
> > > These packages have different content and are targeted at different
> > > users.  I initially thought I could duplicate this behavior using
> > > COMPONENTs in CMake's install command, but it's not behaving how I
> would
> > > like and I'm pretty sure that what I want is abusing the feature (at
> best).
>
> I am really interested in how you did emulate the feature using
> INSTALL / COMPONENT.
> Do you have any CMakeLists.txt and/or CMake macro scripts examples?
> Could you tell us how with those do you invoke cpack or make
> in order to build you packages?
>
> > Ah! I know what you mean but I don't think there is an easy way of doing
> > that. But it's very useful split a package into small packages (debian
> > way -- libfoo.tar.gz, foo.tar.gz, libfoo-dev, foo-docs).
>
> I think it's useful too, but is it specific generator task or is
> it CPack task to do this? (this is an open question).
>
>
> --
> Erk
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080117/714c33c5/attachment.html


More information about the CMake mailing list