abseil/abseil-cpp

[Bug]: CMake install() calls have no COMPONENTs

开放

#1,551 创建于 2023年10月23日

 (3 条评论) (0 个反应) (0 位负责人)C++ (2,546 个派生)batch import
help wanted

仓库指标

星标
 (13,499 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Describe the issue

I am trying to package abseil for installation into an RPM-based environment. CMake/CPack makes this very easy. However, in accordance with the traditional way this is done, I wish to create two RPMs:

  • one with the libraries themselves, meant for installation as a runtime dependency of projects that dynamically link against abseil
  • and one with everything else - header files, cmake targets, etc., meant for installation when developing a project against abseil. This is common called the "devel" package on RPM-based systems.

CPack allows you to control how install() calls are mapped to RPMs, but only if the install() call specifies a COMPONENT. Abseil's cmake configuration doesn't not specify COMPONENTs in the install() commands, so I cannot split them into two separate RPMs.

Steps to reproduce the problem

There aren't really "steps" for this issue, as there is, AFAIK, no way that this "should" work, (yet!). However, I can provide the steps for packaging abseil into two RPMs, assuming there were COMPONENTs defined.

  1. Create a new CMake project
  2. Add abseil-cpp as a subdirectory to that project
  3. Enable install targets for abseil (they are off by default when using abseil as a subproject)
  4. Configure per-component group RPM generation and include CPack
  5. Declare runtime/devel component groups using cpack_add_component_group. One RPM will be built per component group
  6. Map components to groups using cpack_add_component(<component> GROUP <group>). This is the step that cannot be done because all files installed by abseil currently belong to the same default component.
  7. Build project and run cpack.

Cpack can now produce an abseil "runtime" RPM and a "devel" RPM.

What version of Abseil are you using?

20230802.1

What operating system and version are you using?

Rocky Linux 8

What compiler and version are you using?

gcc 8.5.0

What build system are you using?

cmake 3.27.7

Additional context

No response

贡献者指南