有没有办法使用 CPACK + NSIS 指定 Add/Remove 图标?

is there a way to specify the Add/Remove icon using CPACK + NSIS?

我看到这可以使用 nsis 脚本:https://nsis.sourceforge.io/Add_uninstall_information_to_Add/Remove_Programs. There is also an SO post about it (from back in 2013): NSIS MUI Icon in Programs and Features

但是在 CPACK NSIS 生成器文档中,我没有看到任何在“控制面板”->“程序和功能”对话框中指定图标的途径:https://cmake.org/cmake/help/latest/cpack_gen/nsis.html

CMake 和 CPack 可以生成非常好的 nsis 安装程序。 AFAICT 这是唯一缺少的东西!

CPack 文档不是很有帮助。

您需要将 CPACK_NSIS_INSTALLED_ICON_NAME 设置为 .exe 或 .ico 文件名("$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@" 已写入注册表)