CMakeLists.txt 中
find_package(Torch required)
The result was an error and Torch could not be found.
There are three ways to let find_package find the package in the specified path :
Set DIR
Set Torch_DIR in CMakeLists.txt
set(Torch_DIR ~/libtorch-1.0.0)
find_package(Torch required)
Set PATHS
Modified in CMakeLists.txt
set(Torch required PATHS ~/libtorch-1.0.0)
指定 DCMAKE_PREFIX_PATH
When cmake, specify DCMAKE_PREFIX_PATH
cmake -DCMAKE_PREFIX_PATH="~/libtorch-1.0.0" ..