[CMake] cpack multiple packages

Domen Vrankar domen.vrankar at gmail.com
Thu Dec 22 13:43:17 EST 2016


2016-12-21 12:29 GMT+01:00 Dvir Yitzchaki <Dvir.Yitzchaki at ceva-dsp.com>:

> Thanks, but as I understand a component can only belong to one group.
>
> How can I get the same component/target on multiple packages?
>

Usually you wouldn't want to package same file on same location with same
filename since during unpackaging they would override each other so this is
not supported out of the box.

Usually in such cases I would split packages even further so that one
package would be base package of others (but automatic dependency tracking
between them would require something more sophisticated than zip - RPM, Deb
or some other CPack supported packager perhaps).

However if you really need to do something like that you could write a
function that you would call instead of install(...) command which would
just forward to it and the first parameter would have a list of components
to which the file should belong. For e.g. some pseudo code:

function(my_install my_list other_params_that_get_forwarded...)
    foreach(component_name_ IN LISTS my_list)
        install(other_params_that_get_forwarded... COMPONENT
${component_name_})
    endforeach()
endfunction()

my_install("first;second;and_anotherone" "TARGETS target_name" "DESTINATION
some_dir")

Hope this helps.

Regards,
Domen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161222/94549085/attachment.html>


More information about the CMake mailing list