You can avoid dealing with the qt paths when building by having the qtpaths you want to use in your PATH. But it seems that the problem lies in that you are mixing mingw and vs, I see in your log that you are using a Qt for mingw, are you certain ninja is on that path? Maybe you can try with a cmd with the vs variables in PATH and see if you have the same mechanism. It might be related to mingw