cmake - How to with CPack generate the WIX package?
问题描述
I used cmake 3.12.0. There are exists one cmake project that creates one console application. I add the ability of package generation to that cmake project:
# ... above cmake code for one console application creation
# below code that I add:
# pack
set (A_PACK_DESCRIPTION_SUMMARY "${PROJECT_NAME} - CMake Assistant Solution")
set (A_INSTALL_PREFIX Consolas)
set(CPACK_WIX_PRODUCT_GUID "F9AAAAE2-D6AF-4EA4-BF46-B3E265400CC8")
set(CPACK_WIX_UPGRADE_GUID "F9AAAAE2-D6AF-4EA4-BF46-B3E265400CC7")
set(CPACK_GENERATOR "WIX")
include(CPack)
With other generators (NSIS, 7Z, ZIP, DEB) all works fine but with WIX appears followed error:
...path\files.wxs(11) : error LGHT0091 : Duplicate symbol 'Component:CM_C_EMPTY_INSTALL_ROOT' found. This typically means that an Id is duplicated. Check to make sure all your identifiers of a given type (File, Component, Feature) are unique.
Why it happens and how to fix it?
解决方案
This appears to be caused by this bug
Basically you use add_subdirectory(xxx EXCLUDE_FROM_ALL)
where the subdirectory has a install(... COMPONENT ...)
call. The installed files are excluded from the subdirectory, but still creates COMPONENT
s, which are now empty and break wix.
As a workaround, you can add:
set(CPACK_COMPONENTS_ALL Unspecified)
in CMakeLists.txt
to exclude all the empty components.
推荐阅读
- jquery - 显示 div 时未触发 Jquery 事件:无
- git - 主人似乎是发展的孩子
- python - 如何在 Pandas 中管理多个条件
- django - ContentType 对象的 DRF 序列化程序返回 null
- laravel - 为什么此保存功能在本地项目上有效,但在服务器和 cpanel 上无效?
- javascript - 单击右箭头生成下一个日期序列
- ubuntu - 解压缩 z3 求解器失败
- android - 带有firebase firestore的Android studio java尝试使用新的增量
- asp.net - 单声道 TLS 错误 TLSV1_ALERT_PROTOCOL_VERSION
- pandas - 根据另一列区分列中的重复值