Reference/!ifndef: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
No edit summary |
(Making clear how !ifndef applies to multiple gflags [ !x | !y vs. !(x | y) ]) |
||
| (One intermediate revision by one other user not shown) | |||
| Line 3: | Line 3: | ||
gflag [bcheck gflag [...]]] | gflag [bcheck gflag [...]]] | ||
The opposite of !ifdef. The lines will be compiled when the gflag | The opposite of !ifdef. The lines will be compiled when the gflag(s) have not been defined. | ||
<highlight-nsis>! | <highlight-nsis>!define SOMETHING | ||
!ifdef SOMETHING | !ifdef SOMETHING | ||
!echo "SOMETHING is defined" | !echo "SOMETHING is defined" | ||
| Line 12: | Line 12: | ||
!undef SOMETHING | !undef SOMETHING | ||
!ifndef SOMETHING | !ifndef SOMETHING | ||
!echo "SOMETHING is | !echo "SOMETHING is NOT defined" | ||
!endif | |||
!define SOMETHINGELSE | |||
!ifdef SOMETHING | SOMETHINGELSE | SOMEOTHERTHING | |||
!echo "At least one of SOMETHING, SOMETHINGELSE, or SOMEOTHERTHING is defined" | |||
!endif | |||
!ifndef SOMETHING | SOMETHINGELSE | SOMEOTHERTHING | |||
!echo "At least one of SOMETHING, SOMETHINGELSE, or SOMEOTHERTHING is NOT defined" | |||
!endif | |||
!undef SOMETHINGELSE | |||
!ifndef SOMETHING & SOMETHINGELSE & SOMEOTHERTHING | |||
!echo "SOMETHING, SOMETHINGELSE, and SOMEOTHERTHING are all NOT defined" | |||
!endif</highlight-nsis> | !endif</highlight-nsis> | ||
Latest revision as of 22:20, 29 June 2017
!ifndef
gflag [bcheck gflag [...]]]
The opposite of !ifdef. The lines will be compiled when the gflag(s) have not been defined.
!define SOMETHING !ifdef SOMETHING !echo "SOMETHING is defined" !endif !undef SOMETHING !ifndef SOMETHING !echo "SOMETHING is NOT defined" !endif !define SOMETHINGELSE !ifdef SOMETHING | SOMETHINGELSE | SOMEOTHERTHING !echo "At least one of SOMETHING, SOMETHINGELSE, or SOMEOTHERTHING is defined" !endif !ifndef SOMETHING | SOMETHINGELSE | SOMEOTHERTHING !echo "At least one of SOMETHING, SOMETHINGELSE, or SOMEOTHERTHING is NOT defined" !endif !undef SOMETHINGELSE !ifndef SOMETHING & SOMETHINGELSE & SOMEOTHERTHING !echo "SOMETHING, SOMETHINGELSE, and SOMEOTHERTHING are all NOT defined" !endif