Getting C1001 Internal compiler error when building pytorch on windows

I mean the VS project that uses LibTorch. Did you create that project by hand or using CMake?

I created that by hand. The projects are primarily developed under windows using VS but I also wrote cmake for other platforms which are mainly used for the build process.
So no I do not use cmake in windows.
All the libs that use libtorch are also marked as libs themselves (Properties configuration type set to lib with MT set in code generation) . and I rebuild them each time so I dont miss anything.

You should be able to see additional flags you need in [LIBTORCH_ROOT]\share\cmake\Caffe2\Caffe2Targets.cmake.

Thanks a lot. really appreciate your time and kind help.
I’ll have a look at it and see how this goes.

Here’s an update.
I couldnt find any clue how to get the static MT build to run. I always get linker errors. this might be an issue on libtorch, not sure.
The shared(dll) build builds just fine with /MT switch.
I ultimately used my first method (generating a vs solution from cmake as I explained here ) the missing dlls where generated in another directory /bin instead of the /lib directory which the lib and exp files were generated.
going and changing the library configurations from dll to lib did build the libs, but upon using them, the very same issue appeared. making me very suspecious that this might be a misconfiguration on the libtorch (maybe cmake doesnt generate the configs properly or some libs are bound to be shared)
anyway, it would be very appreciated if anyone could also verify or refute this.

sidenote:
As you can see, when visual studio solution is made, you can not have successful compilation simply becasue, some projects are looking in the wrong place for the required dependencies (i.e. /bin, /lib) this signals to me at least that, the cmake needs to change to rectify all of this. and the issues I faced here might very well be becasue of this.