CMake: How to pack a target / file into multiple packages on Linux?

I am working on a project that generates many executable files, libraries and configs, they must be packaged in different packages for deployment. The problem is that the inclusion of these targets / files is not mutual exclusive. One target / file can belong to several packages.

I am using CMake 2.8.9 and trying to use CPack. I know that this can be done with set types. But my platform is Ubuntu, so there are Archives / Debs and they don't seem to support this.

With components / groups / parent groups, it seems possible to pack only one target / file into one component / group.

Is there a way out of this?

thanks

+4
source share
2 answers

Well, I will answer this myself for the convenience of later visitors: from the CMake email list, I got the answer: with cmake 2.8.9 or earlier (for now), start CPack several times with various component settings. This is a bit of adhok, but does the job.

+3
source

Why not use components? If I understand correctly, you want to create more than one deba from your project.

I achieve this:

SET(CPACK_DEB_COMPONENT_INSTALL 1) INSTALL(TARGETS buildA DESTINATION lib/myproj COMPONENT main) INSTALL(TARGETS buildB DESTINATION include/myproj COMPONENT dev) 

When I call make package , I get two debts with the suffixes main and dev , containing only what I specified with the INSTALL () instructions.

+4
source

Source: https://habr.com/ru/post/1443601/


All Articles