Name and description of several debian packages with CMake and CPack

I am currently trying to create more than one debian package from my project. My only problem with this is to set name, description, group, etc. Packages.

# -------------------------------------------------------------- # Required CMake version # -------------------------------------------------------------- CMAKE_MINIMUM_REQUIRED (VERSION 2.8) # -------------------------------------------------------------- # Project name # -------------------------------------------------------------- PROJECT (MyProject) # -------------------------------------------------------------- # Find all source and header files # -------------------------------------------------------------- FILE (GLOB all_H "*.h") FILE (GLOB all_SRC "*.cpp") # -------------------------------------------------------------- # Set compiler flags # -------------------------------------------------------------- SET (CMAKE_CXX_FLAGS "-Wall -Wextra -O0 -g3") # -------------------------------------------------------------- # Add a shared library # -------------------------------------------------------------- ADD_LIBRARY (mylib SHARED ${all_H} ${all_SRC}) # -------------------------------------------------------------- # Configure components # -------------------------------------------------------------- SET (CPACK_DEB_COMPONENT_INSTALL 1) # -------------------------------------------------------------- # Install # -------------------------------------------------------------- INSTALL(TARGETS mylib DESTINATION ../lib COMPONENT main) INSTALL(FILES ${all_H} DESTINATION ../include COMPONENT dev) # -------------------------------------------------------------- # CPack package and package_source targets # -------------------------------------------------------------- SET (CPACK_GENERATOR "TGZ;DEB") SET (CPACK_SET_DESTDIR ON) SET (CPACK_PACKAGE_NAME "mypackage") SET (CPACK_PACKAGE_VENDOR "me") SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "this is my package description") SET (CPACK_DEBIAN_PACKAGE_DESCRIPTION "this is my package description here comes detailed description text.") INCLUDE (CPack) 

There are some properties and commands for CPack components in the manual, but I do not seem to find it necessary or a suitable place to change to the smallest name and description for each individual package / component.

I tried using SET (CPACK_COMPONENT_MAIN_DISPLAY_NAME "main display name") and SET (CPACK_COMPONENT_MAIN_DISPLAY_NAME "main display name") , as well as cpack_add_component () before INCLUDE (CPack) (which gives me an error) and after (which seems to be ignored).

Has anyone made this work and knows the right way to do it?

+4
source share
2 answers

In recent days, I have been looking for such a solution. Let me first explain my requirement first, and then how I managed to solve the problem.

I want to create 4 packages from my one project

  • Main package : contains all binary, static / shared libraries, header files, configuration files and scripts.
  • Runtime package : contains only the executable file that is required to run my application, i.e. binary, shared library and scripts.
  • Configuration package : contains the main skeleton and space holder for the configuration file.
  • Development Packs : Contains shared / static libraries and header files.

Creating a Master package is easy and straightforward. But if I use this path, then I can not use other packages. Therefore, after the struggle and cleaning of documents and mail archives, I came to one solution or a workaround.

In my solution, I create one additional custom target for each package that I want to create. For this purpose, I create another cmake project in which there is a list of files (Absolute file location) that need to be installed in this package, create this project and last create the package by calling cpack.

Here is my solution.

There may be a better / scalable solution than this. If anyone meets this, let me know.

+1
source

I'm a bit late to the party, but in CMake, before packaging components of version 3.5, it is not supported for debian packages for CPack.

In version 3.5, several functions were added for each component, so the easiest way to solve your problem would be to sketch out the CMake version and set the variables described in the documentation:

https://cmake.org/cmake/help/v3.5/module/CPackDeb.html or newer https://cmake.org/cmake/help/v3.9/module/CPackDeb.html

0
source

All Articles