Package name passed to 'find package handle standard args' (torch) does not match the name of the calling package(Torch)

I have installed pytorch in virtual environment and am trying to convert a pytorch model to C++ by converting it to TorchScript via tracing and then using cmake to convert the model into C++. When try to run the command
cmake -DCMAKE_PREFIX_PATH=$PWD/…/libtorch …
I am getting the following error ->

-- Caffe2: CUDA detected: 10.1
-- Caffe2: CUDA nvcc is: /usr/local/cuda-10.1/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-10.1
-- Caffe2: Header version is: 10.1
-- Found cuDNN: v7.6.5  (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libcudnn.so)
-- Autodetected CUDA architecture(s):  6.1
-- Added CUDA NVCC flags for: -gencode;arch=compute_61,code=sm_61
CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (torch) does
  not match the name of the calling package (Torch).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /local/mnt2/workspace2/Virtual_Env/venv-glow/lib/python3.7/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:130 (find_package_handle_standard_args)
  CMakeLists.txt:4 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done

The CMakeLists.txt contains the following code->

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(Pytorch_test_model)
find_package(Torch REQUIRED)
add_executable(Pytorch_test_model main.cpp)
target_link_libraries(Pytorch_test_model "${TORCH_LIBRARIES}")
set_property(TARGET Pytorch_test_model PROPERTY CXX_STANDARD 11)

How can I resolve this error?

There seems to be an issue when you try to compile it with GCC I was able to pass the following flags when passing the cmake commands and able to compile it

cmake -DCMAKE_PREFIX_PATH=$PWD/…/libtorch -DCMAKE_C_COMPILER="/usr/bin/clang" -DCMAKE_CXX_COMPILER="/usr/bin/clang++" … -Wno-dev

Can someone let me know what the issue is?

For sure the “solution” is not even a real solution. Warning issued when GCC as compiler means there must be something wrong somewhere. I think this should be an issue on github repo if reproduction is possible on the latest release.