[Bug]: CMake install() calls have no COMPONENTs
- Dominant language
- C++
- Stars
- 18.1k
- Forks
- 3.2k
- Avg merge
- 20h 36m
- Merged PRs (30d)
- 1
Description
### 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 `COMPONENT`s 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( 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_
Contributor guide
Assessment
This issue has not been assessed yet.