[CMake] cpack multiple packages

Dvir Yitzchaki Dvir.Yitzchaki at ceva-dsp.com
Thu Jan 5 04:28:55 EST 2017


Hi Domen.

That works perfectly. This is my code if anyone’s interested:

function(install_common)
    foreach(component ${ALL_COMPONENTS})
         install(${ARGV} COMPONENT ${component})
    endforeach()
endfunction()

where ALL_COMPONENTS is a global variable holding all components.

Thanks,
Dvir

From: Domen Vrankar [mailto:domen.vrankar at gmail.com]
Sent: Thursday, December 22, 2016 20:43
To: Dvir Yitzchaki <Dvir.Yitzchaki at ceva-dsp.com>
Cc: Eric Noulard <eric.noulard at gmail.com>; cmake at cmake.org
Subject: Re: [CMake] cpack multiple packages

2016-12-21 12:29 GMT+01:00 Dvir Yitzchaki <Dvir.Yitzchaki at ceva-dsp.com<mailto: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/20170105/db861033/attachment-0001.html>


More information about the CMake mailing list