cpack在这里描述了一个bug,其中单片构建包括deb包的md5sums文件中的构建目录路径: https://gitlab.kitware.com/cmake/cmake/issues/16517
由于我在cmake 3.7中使用debian stretch,所以这个bug仍然存在,所以我尝试使用建议的解决方法。
解决方法是启用cpack的组件,如下所示:
set(CPACK_COMPONENTS_ALL component_name) set(CPACK_DEB_COMPONENT_INSTALL "ON")
但是,问题是当我从 mypackage 到 mypackage-component_name 。
mypackage
mypackage-component_name
有办法抑制 -component_name 后缀时,建立一个非单一的建设,使我的用户看不到区别?
-component_name
我找到了解决办法。我们需要设置 CPACK_DEBIAN_<component>_PACKAGE_NAME . 以我为例 <component>=runtime .
CPACK_DEBIAN_<component>_PACKAGE_NAME
<component>=runtime
set(CPACK_COMPONENTS_ALL runtime) set(CPACK_DEB_COMPONENT_INSTALL "ON") set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME ${CPACK_PACKAGE_NAME})
参考文献: https://cmake.org/cmake/help/v3.7/module/CPackDeb.html