How to set wizard images in NSIS through CMake/CPack?

荒凉一梦 提交于 2019-12-11 07:02:43

问题


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.


回答1:


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.




回答2:


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@"

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")


来源:https://stackoverflow.com/questions/6027927/how-to-set-wizard-images-in-nsis-through-cmake-cpack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!