带有CMake和CPack的多个debian软件包的名称和描述 [英] Name and description of multiple debian packages with CMake and CPack

查看:165
本文介绍了带有CMake和CPack的多个debian软件包的名称和描述的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试从我的项目中生成多个debian软件包。我唯一的问题是设置软件包的名称,描述,组等。

I am currently trying to generate more than one debian package from my project. My only problem with this is setting the name, description, group and so forth of the 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)

手册具有某些属性和CPack组件的命令,但我似乎找不到合适的组件或正确的位置来更改每个软件包/组件的名称和描述。

The manual has some properties and commands for CPack Components but I doesn't seem to find the right ones or the right place to change at least name and description for every single package/component.

I尝试使用 SET(CPACK_COMPONENT_MAIN_DISPLAY_NAME主要显示名称) SET(CPACK_COMPONENT_main_DISPLAY_NAME主要显示名称) cpack_add_component()在INCLUDE(CPack)之前(这给我一个错误)和之后(似乎被忽略了)。

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).

有人让它起作用了吗?知道正确的方法吗?

Did anybody get this to work and knows the right way to do this?

推荐答案

我参加聚会有点晚了,但是在3.5版本组件封装之前的CMake中不支持CPack debian软件包。

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

从3.5版开始,添加了许多每个组件的功能,因此解决问题的最简单方法是提高版本CMake并设置文档中描述的变量:

From version 3.5 on quite a few per component features were added so the easiest way to solve you problem would be to bump the version of CMake and set the variables described in the documentation:

https://cmake.org/cmake/help/v3.5/module/CPackDeb.html 或更新的
> https://cmake.org/cmake/help/v3.9/module/CPackDeb.html

这篇关于带有CMake和CPack的多个debian软件包的名称和描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆