Question

I have a Jenkins slave with Visual Studio 2012 and want to build for x64. What I need is the prompt environment I get when I run the tools prompt link in the Windows Start Menu. People suggest to do it like this (in a Jenkins Windows Batch prompt):

call "%VS110COMNTOOLS%vsvars32.bat" x86_amd64

But this is not enough. There are small differences in the PATH, LIB and LIBPATH environment variables: the paths in there point to the x32 paths only, e.g. to

...;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;...

instead of

...;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\x86_amd64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;...

In fact I am trying to build with the Ninja generator from CMake where the build configuration is determined by the prompt environment.

Was it helpful?

Solution

You need to call vcvarsall.bat x86_amd64 which is located in the VC-subdirectory (and eventually remove parentheses from the PATH):

set path=%path:"=%
call "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" x86_amd64

If you want to run this in a Pipeline script:

bat """set path=%path:\"=%
       call "%vs110comntools%..\\..\\VC\\vcvarsall.bat" x86_amd64
       ..."""
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top