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

2

1

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.

Ligature answered 17/5, 2011 at 8:0 Comment(2)
You can try to modify your NSIS.template.in file while running cmake using file command. For example: file(APPEND NSIS.template.in !define FILEID ${PROJECT_SOURCE_DIR}/path/to/file !define)Reamy
I could modify the file this way.. or even better, copy it and then append to the copy. However, then the defines will end-up at the bottom of the script resulting in something like: MUI_WELCOMEFINISHPAGE_BITMAP is already defined (even though i have taken out the definition of it)... Although even if it didn't result in a preprocessing error, it still comes after the !insertmacro for MUI.Ligature
W
1

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")
Whereabouts answered 12/10, 2011 at 20:45 Comment(2)
Thanks. But it seems these variables must have only "CPACK" prefix. Otherwise CPack ignores them and they would have an empty value in nsi.Natalee
the path is not defined correctly, see: cmake.org/pipermail/cmake/2008-June/022085.htmlSinglefoot
F
0

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.

Fecit answered 23/5, 2011 at 13:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.