如何通过CMake / CPack在NSIS中设置向导映像? [英] How to set wizard images in NSIS through CMake/CPack?

查看:258
本文介绍了如何通过CMake / CPack在NSIS中设置向导映像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到在NSIS中没有用于更改向导映像的CPACK_xxx变量(如CPACK_PACKAGE_ICON)。
所以我复制了NSIS.template.in并对其进行了修改。我可以做这样的事情:

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

!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.

因此,如果有人知道如何在NSIS中设置向导映像,或将源目录(并从中创建路径)传递到我的模板文件。

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.

推荐答案

由于您已经自定义了NSIS.template.in文件,并且它大概是使用CONFIGURE_FILE()命令配置的模板,所以为什么不将以下内容放入NSIS.template.in中:

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:

!define MUI_WELCOMEFINISHPAGE_BITMAP "@MY_CPACK_MUI_WELCOMEFINISHPAGE_BITMAP@"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "@MY_CPACK_MUI_UNWELCOMEFINISHPAGE_BITMAP@"

然后,在设置其他CPACK变量的CMakeLists.txt文件中,添加以下内容:

Then, in your CMakeLists.txt file where you set your other CPACK variables, add something like:

SET(MY_CPACK_MUI_WELCOMEFINISHPAGE_BITMAP
    "${CMAKE_SOURCE_DIR)/path/to/wizardInstall.bmp")
SET(MY_CPACK_MUI_UNWELCOMEFINISHPAGE_BITMAP
    "${CMAKE_SOURCE_DIR)/path/to/wizardUninstall.bmp")

这篇关于如何通过CMake / CPack在NSIS中设置向导映像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆