Skip to content
⌘ NSIS Forum Archive

How do I create four variants of the same installer?

3 posts

BloodBaz#

How do I create four variants of the same installer?

Hello,
I am trying to make four variants of the same installer but with minor differences.
Not wanting to clone (and maintain) my nsi file four times, I would like to be able to do any of the following but so far I haven't managed to find a way of doing any of them:
  • Adding a variable/preprocessor directive onto the NSIS compiler which can be used to enable/disable different parts of the script
  • Creating four dummy nsi files that set a variable and then !include the "main.nsi" file which makes us of the variable (preprocessor directives don't seem to exist and variables can only be definied in .onInit - even global ones)


Am I missing a trick? or is there a feasiable way to implement one of the above?

Thanks for listening!
BloodBaz
🤪
Marshall7a#
Compile Time Commands


variant1.nsi:
!define VARIANT "1"
!include main.nsi

variant2.nsi:
!define VARIANT "2"
!include main.nsi

main.nsi:
!if "${VARIANT}" == "1"
Name "Installer Variant One"
!else if "${VARIANT}" == "2"
Name "Installer Variant Two
!endif
BloodBaz#
Thanks Marshall7a. Exactly what I am looking for.
Now that you have pointed me to !define and !if ${}, I have found it in the docs.
Cheers. ;-)