My project is built by builbot using cmake and the Visual Studio C++ compiler.
Using "Visual Studio 14 2015 Win64" as generator it works but it builds slowly and I have difficulties to find the source of an error (this is another problem).
So I want to try Ninja but when I set it as the generator it selects the GNU C++ compiler. I found that I should load the vcvarsall.bat before calling Ninja but I don't understand how to do it from buildbot.
The solution was to:
vcvarsall.bat
as I wrote in the question and suggested by @valianoCMAKE_IGNORE_PATH
as suggested in the question linked to by @FlorianPoint 2 summarizes in editing the buildbot.tac file of the worker by adding the following lines:
from subprocess import check_output
for v in check_output(['path\\to\\vcvarsall.bat',
'x86', '&&', 'set']).strip().split('\r\n'):
v = v.split('=', 1)
os.environ[v[0]] = v[1]