Cannot build torchvision c++ on windows

Hi Everybody,

I am trying to build torchvision using cmake on windows. I have VS 2019 installed. libtorch 2.2.2 with cuda 11.8 is also installed and working. I need torchvision ops for my model to load.
After I get torchvision 0.17.2 from the tags, I proceed to build it according to the readme file. cmake … gives me the following:

CMake Error at CMakeLists.txt:18 (find_package):
By not providing “FindTorch.cmake” in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by “Torch”, but
CMake did not find one.
Could not find a package configuration file provided by “Torch” with any of
the following names:

  • TorchConfig.cmake
  • torch-config.cmake

Add the installation prefix of “Torch” to CMAKE_PREFIX_PATH or set
“Torch_DIR” to a directory containing one of the above files. If “Torch”
provides a separate development package or SDK, be sure it has been
installed.
– Configuring incomplete, errors occurred!

I changed the name of TorchVisionConfig.cmake.in to TorchVisionConfig.cmake under the cmake folder
now I get this error:

Severity Code Description Project File Line Suppression State
Error CMake Error at C:/src/packages/torchvision-0.17.2/vision/cmake/TorchVisionConfig.cmake:7:
Parse error. Expected a command name, got unquoted argument with text
@PACKAGE_INIT@”. C:/src/packages/torchvision-0.17.2/vision/cmake/TorchVisionConfig.cmake 7

Any help on building or using torchvision is highly appreciated

Thanks