Archive: How can I set an Environment variable at Compile Time?


How can I set an Environment variable at Compile Time?
Here's my problem..
I create a dynamic OutFile name based upon the version of the core application exe (Thanks LibraryLocal).
After the installer is created I need to codesign it.
Since the exe name changes every time, the command line to codesign.exe needs to change every time.

My theoretical solution is to alter my script to set an environment variable (%zOutFile%) at compile time & use a batch file that..
* calls makensis.exe to compile the script
* calls codesign.exe with the dynamic %zOutFile% environment variable

unfortunately when I modified my script (Before the sections)
!system "set zOutFile=${OutFile}" $R0
it didn't work :(

Help?

Maybe I'm thinking about this all wrong? Is there a "PostBuild" section in NSIS? that would allow for actions "after" the OutFile is finalized? probably not.


If you're calling makensis you can simply pass the /D command line switch to create a define.

makensis /DOUT_FILE=myinstaller.exe
OutFile ${OUT_FILE}