I’ve configured Microsoft Visual Studio to use a Makefile configuration type, and I’ve written a makefile to build my project using the Microsoft tools. Under the NMake section of the project configuration I’ve set the build commandline to be build.bat, which is a file which simply invokes nmake with my makefile as command line argument, like so:
nmake /nologo /f makefile.x86.winnt.msvc2010
This works just fine.
For cleaning, I wrote a target in my makefile which deletes all the build artifacts. It looks like this:
#... the rest of the makefile
clean:
@erase /f /q $(OBJS) $(OUT) $(MAPFILE) $(PDBFILE)
@echo + clean
So I set the clean command line to be an nmake invocation with clean as an argument. Like this:
nmake /nologo /f makefile.x86.winnt.msvc2010 clean
I placed this text into clean.bat and set it as the “Clean Command Line,” but it doesn’t work because the invoking shell cannot locate nmake. I checked the path at the time of the clean invocation and MSVS doesn’t include the build tools in the path (including nmake) for cleans. (Note that running the above nmake command succeeds from a shell which has nmake in the PATH).
How can I get MSVS to include the build tools in the PATH so I can invoke nmake in the clean command line? Or is there a better solution?
Quoting from the Visual Studio Express Readme: