Archive: ever needed compile time "if" statements?


ever needed compile time "if" statements?
here you go:
http://sourceforge.net/tracker/index...49&atid=373087

apply the patch to current cvs (date of the patch submission), recompile makensis.exe (execute "SCONS makensis" in your nsis folder) and you're done.

you may now use constructions like:

!if ${NSISVERSION} = 2.0
...
!else if ${NSISVERSION} = 2.1
...
!else
...
!endif

CAREFUL:

!if ${NSISVERSION} > 2.0
wont work very well, because > is an integer only operator, and does not support floating points at the moment.

maybe i'll implement this one later.


Comm@nder21, I'd find this extremely helpful. It seems like this would make it very easy to build several different flavors/intls from the same script.


Nice initiative, but without this that is also already possible. E.g. with defines

;Install of the MYAPPSIX Application
!ifdef INCLUDE_MYAPPSIX
Section "$CompanyNameShort $SEC06_DESCRIPTION" SEC06

;Do your things here

SectionEnd
!endif

; And use it also in un-install

!ifdef INCLUDE_MYAPPSIX
Section "un.$CompanyNameShort $SEC06_DESCRIPTION" un.SEC06

;Do your uninstall things here

SectionEnd
!endif


That doesn't cover comparison of defines values though onad :)

You can do value comparisons without this though by doing the following:

!define Ver 1.1

!define Compare_${Ver}
!ifdef Compare_1.0
...
!else ifdef Compare_1.1
...
!endif


Obviously you can't do a less or greater than comparison here though.

-Stu

Glad to see this made the 2.15 release. Nice job! Looking forward to using it.