CPACK_RPM_[COMPONENT]_PACKAGE_PREFIX Ignored
CMake version for issue: v3.29.0-rc2
I'm having a strange issue with CPACK_RPM_[COMPONENT]_PACKAGE_PREFIX
In my toy example, I have two components, "apps" and "libs". They build into separate RPMs as expected, no issues there. However, I can't configure them to have different default install prefixes for the RPMs. The behavior I'm experiencing makes it appear that that CPACK_RPM_apps_PACKAGE_PREFIX
and CPACK_RPM_libs_PACKAGE_PREFIX
are effectively ignored, even though they're recognized by the CPack RPM module?
My simple example:
set(CPACK_GENERATOR "RPM")
set(CPACK_RPM_PACKAGE_DEBUG ON)
set(CPACK_PACKAGE_NAME "example-package")
set(CPACK_PACKAGE_DESCRIPTION "Minimum reproducible example for this issue.")
set(CPACK_PACKAGE_VENDOR "Me")
set(CPACK_RPM_apps_FILE_NAME "${CPACK_PACKAGE_NAME}-apps.${CMAKE_HOST_SYSTEM_PROCESSOR}.rpm")
set(CPACK_RPM_libs_FILE_NAME "${CPACK_PACKAGE_NAME}-libs.${CMAKE_HOST_SYSTEM_PROCESSOR}.rpm")
set(CPACK_RPM_PACKAGE_RELOCATABLE ON)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL apps libs)
# Package default installation locations
set(CPACK_RPM_apps_PACKAGE_PREFIX "/opt/example-package-apps/")
set(CPACK_RPM_libs_PACKAGE_PREFIX "/opt/example-package-libs/")
When I inspect the resulting rpm, it shows all the files with the default prefix /usr
. However, the CPACK_RPM_PACKAGE_DEBUG
output clearly shows that the per-component prefixes were at least detected. For example, an output snippet for the "apps" component:
CPackRPM:Debug: processing PREFIX
CPackRPM:Debug: using CPACK_RPM_PACKAGE_PREFIX
CPackRPM:Debug: User defined Prefix:
/opt/apps/
My best guess is something odd is going on here: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/Internal/CPack/CPackRPM.cmake?ref_type=heads#L130
Could there be an issue with the ${CPACK_RPM_PACKAGE_COMPONENT}
substitution (this one is confusing since CPACK_RPM_PACKAGE_COMPONENT
is defined in the documentation as being ON
or True
, not a list of component names)? I'm not terribly familiar with the module though, so I could be off the mark.
Would someone be able to help me out? It would be much appreciated.