CPack has a bug described here where monolithic builds include the build-directory path in the md5sums file for DEB packages: https://gitlab.kitware.com/cmake/cmake/issues/16517
Since I'm using debian-stretch with CMake 3.7, the bug still exists for me and so I am trying to use the suggested workaround.
To work around is to enable CPack's components like so:
set(CPACK_COMPONENTS_ALL component_name)
set(CPACK_DEB_COMPONENT_INSTALL "ON")
However, then problem is that my package name changes when I do this from mypackage
to mypackage-component_name
.
Is there a way to inhibit -component_name
suffix when building a non-monolithic build so that my users don't see a difference?
I found the solution. We need to set CPACK_DEBIAN_<component>_PACKAGE_NAME
. In my case <component>=runtime
.
set(CPACK_COMPONENTS_ALL runtime)
set(CPACK_DEB_COMPONENT_INSTALL "ON")
set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
Reference: https://cmake.org/cmake/help/v3.7/module/CPackDeb.html