Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Environment Variables For NMAKE Before Building A 'Makefile Solution'

I have an MSVC Makefile Project in which I need to set an environment variable before running NMAKE. For x64 builds I needs to set it to one value, and for x86 builds I need to set it to something else.

So for example, when doing a build I would want to SET PLATFORM=win64 if I'm building a 64-bit compile, or SET PLATFORM=win32 if I'm building 32-bit.

There does not appear to be an option to set environment variables or add a pre-build even for makefile projects.

How do I do this?

EDIT: Running MSVC 2008

like image 942
John Dibling Avatar asked Dec 03 '25 17:12

John Dibling


1 Answers

Just edit the Configuration Properties + NMake + Build Command Line. Click the button with the dots and enter something like this:

set PLATFORM=win32
nmake -f makefile.mak

Repeat for your 64-bit configuration.

like image 198
Hans Passant Avatar answered Dec 06 '25 07:12

Hans Passant