如何通过CMake/CPack在NSIS中设置向导图像?
我发现 NSIS 中没有用于更改向导图像的 CPACK_xxx 变量(如 CPACK_PACKAGE_ICON)。 所以我复制了NSIS.template.in并修改了它。我可以这样做:
!define MUI_WELCOMEFINISHPAGE_BITMAP "C:\work\project\img\wizardInstall.bmp" !define MUI_UNWELCOMEFINISHPAGE_BITMAP "C:\work\project\img\wizardUninstall.bmp"
就可以了。然而,源代码位于许多开发人员协作的存储库中,在那里保留绝对路径并不是一个好主意。 我试图找到某种方法来获取我的源路径,并以某种方式从该路径创建图像路径,但无济于事。
因此,如果有人知道如何在 NSIS 中设置向导图像,或将源目录(并从中创建路径)传递到我的模板文件,请告诉我。
I see that there is no CPACK_xxx variable for changing the wizard image(s) in NSIS (like CPACK_PACKAGE_ICON).
So I copied the NSIS.template.in and modified it. I could do something like:
!define MUI_WELCOMEFINISHPAGE_BITMAP "C:\work\project\img\wizardInstall.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "C:\work\project\img\wizardUninstall.bmp"
and it will work. However, the source code goes in a repository where many developers colaborate, and it's not really good idea to keep absolute paths there.
I tried to find some way to get my source path, and somehow create the image path from that one, but to no avail.
So, if someone knows how can i set the wizard images in NSIS, or pass the source dir (and create the path from it) to my template file, please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您已经自定义了 NSIS.template.in 文件,并且它是一个大概使用 CONFIGURE_FILE() 命令配置的模板,为什么不将以下内容放入您的 NSIS.template.in 中:
然后,在您的 CMakeLists.txt 文件中,其中设置其他 CPACK 变量,添加如下内容:
Since you are already customizing the NSIS.template.in file, and it is a template presumably configured with the CONFIGURE_FILE() command, why not put the following in to your NSIS.template.in:
Then, in your CMakeLists.txt file where you set your other CPACK variables, add something like:
您不需要编译整个 NSIS 来使用/更改这些图像。
它们存在于每台安装了 NSIS 的计算机上 ${NSISDIR}\Contrib\Graphics\Wizard\win.bmp
在 .nsi 脚本中使用
!define MUI_WELCOMEFINISHPAGE_BITMAP bmp_file
改变他们。You do not need to compile whole NSIS to use/change these images.
They are present on every machine which has NSIS installed in ${NSISDIR}\Contrib\Graphics\Wizard\win.bmp
Use
!define MUI_WELCOMEFINISHPAGE_BITMAP bmp_file
in your .nsi script to change them.