iamhankai / cpp-pytorch

A bite of cpp api in PyTorch-1.0
165 stars 40 forks source link

CMake Error at find Torch package #1

Closed LvJC closed 5 years ago

LvJC commented 5 years ago

I follow your step but meet this error. But same libtorch/ works well in official doc: https://pytorch.org/tutorials/advanced/cpp_export.html

I am confused!

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!

LvJC commented 5 years ago

OK, it's solved by add $PWD/ in the sentence:

cmake -DCMAKE_PREFIX_PATH=$PWD/../libtorch ..