gpt4 book ai didi

cmake - 如何在 NSIS 安装 (CMake) 中设置图标

转载 作者:行者123 更新时间:2023-12-04 23:48:04 24 4
gpt4 key购买 nike

CPACK_PACKAGE_ICON 的文档在 cmake 上非常有限 wiki page .

以下对我不起作用(如 per ):

set(CPACK_PACKAGE_ICON  "${CMAKE_CURRENT_SOURCE_DIR}/images/MyIcon.bmp")
include(CPack)

它导致:
File: "C:/proj/my_library/images/MyIcon.bmp" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in macro MUI_HEADERIMAGE_INIT on macroline 24
Error in macro MUI_GUIINIT on macroline 3
Error in macro MUI_FUNCTION_GUIINIT on macroline 4
Error in macro MUI_INSERT on macroline 11
Error in macro MUI_LANGUAGE on macroline 7
Error in script "C:/proj/bin-win/_CPack_Packages/win32/NSIS/project.nsi" on line 574 -- aborting creation process

那么如何在 NSIS 安装程序的安装过程中实际设置工作图标呢?图标实际需要什么格式?

最佳答案

经过反复试验,我终于发现了两个需要的技巧:

语法实际上是:

set(CPACK_PACKAGE_ICON  "${CMAKE_CURRENT_SOURCE_DIR}/images\\\\MyIcon.bmp")

并且 BMP 文件仅限于旧格式,这不是 imagemagick 的默认格式。例如:
$ file MyIcon.bmp
MyIcon.bmp: PC bitmap, Windows 98/2000 and newer format, 128 x 128 x 24

需要的是这样的:
$ convert MyIcon.bmp BMP3:MyIcon2.bmp
$ file MyIcon2.bmp
MyIcon2.bmp: PC bitmap, Windows 3.x format, 128 x 128 x 24

第一个表示( Windows 98/2000 and newer format )对我不起作用。

关于cmake - 如何在 NSIS 安装 (CMake) 中设置图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28768417/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com