How to set wizard images in NSIS through CMake/CPa

2019-08-11 01:07发布

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.

标签: cmake nsis cpack
2条回答
不美不萌又怎样
2楼-- · 2019-08-11 01:39

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.

查看更多
女痞
3楼-- · 2019-08-11 02:04

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")
查看更多
登录 后发表回答