Let’s break this into several steps.

‘https://pytorch.org/cppdocs/installing.html’ 15 follow this to build libtorch with simple example. Make sure it works.
Make sure your code compiled successfully before adding libtorch.
Now, start to do cross build, merge libtorch’s cmake file with your cmake file.

For this, I think probably you need a cmake tutorial. It would be very hard for me figure out each symbol’s correct location in your makefile.
From your error log:
a. I am not sure why setting up CMAKE_PREFIX_PATH doesn’t work. Can you try set it up in command line?
b. I double checked -lz, -ldl, -fPIC, -lz and -ldl is libraries, and -fIPC is compile options. So you can put -lz and -ldl back to target_link_libraries and -fIPC should be compile options, you can try add_compile_opitions as well.
c. You comment the “{TORCH_LIBRARIES}”, and add absolute path.
Can you add libtorch_cpu.so, libtorch_gpu.so, libtorch_python.so as well. Please verify the libs here libtorch/lib, I think we don’t have libc10_cuda.so, but it is in your CMakeList.txt