Torchvision C++ Build Error

Command:
cmake -DCMAKE_PREFIX_PATH=“D:\AI\libtorch;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\pybind11-2.11.1\pybind11;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\lpng1643;C:\libjpeg-turbo64;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\libjpeg;C:\Users\Henry Z\Desktop\VI\Visual Studio\Additional Header Files\zlib;D:\AI\vision-deps” … -DCMAKE_INSTALL_PREFIX=“D:\AI\vision-0.19.0” -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" -A x64 -DWITH_CUDA=on …

Output:
– Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
– The C compiler identification is MSVC 19.41.34120.0
– The CXX compiler identification is MSVC 19.41.34120.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– The CUDA compiler identification is NVIDIA 12.4.99
– Detecting CUDA compiler ABI info
– Detecting CUDA compiler ABI info - done
– Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/bin/nvcc.exe - skipped
– Detecting CUDA compile features
– Detecting CUDA compile features - done
– Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4 (found version “12.4”)
– Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/include (found version “12.4.99”)
– Caffe2: CUDA detected: 12.4
– Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/bin/nvcc.exe
– Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4
– Caffe2: Header version is: 12.4
CMake Warning at D:/AI/libtorch/share/cmake/Caffe2/public/cuda.cmake:153 (message):
Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
D:/AI/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:86 (include)
D:/AI/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
CMakeLists.txt:24 (find_package)

– Found CUDNN: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4/lib/x64/cudnn.lib
– USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
– Autodetected CUDA architecture(s): 8.9
– Added CUDA NVCC flags for: -gencode;arch=compute_89,code=sm_89
– Found Torch: D:/AI/libtorch/lib/torch.lib
– Found ZLIB: D:/AI/vision-deps/zlib.lib (found version “1.2.11”)
– Found PNG: D:/AI/vision-deps/libpng16.lib (found version “1.6.43”)
– Found JPEG: C:/libjpeg-turbo64/lib/jpeg.lib (found version “62”)
– Configuring done (39.8s)
– Generating done (0.1s)
– Build files have been written to: D:/AI/vision-0.19.0/build

Open torchvision.sln switch to Release, click ‘build’ and get 37 Similar Errors:
|Error|LNK2019 png_write_row,function class at::Tensor __cdecl vision::image::encode_png(class at::Tensor const &,__int64) (?encode_png@image@vision@@YA?AVTensor@at@@AEBV34@_J@Z)|torchvision|D:\AI\vision-0.19.0\build\encode_png.obj|1|||

Adding libpng.lib to additional dependencies doesn’t work, can someone help me solve this issue?