Hello everyone !
I tried to follow this installation tuto step by step : https://pytorch.org/cppdocs/installing.html 8
I reached the point where I use the cmake command, but it won’t work. I made a folder “example-app” which contains:

“example-app.cpp” file
“MakeList.txt” file
“libtorch” folder
“build” folder

using cmake from the build folder (as written in the tutorial ?) is useless, it just tells me there’s no makelist file in the folder. I of course did my following tests from the example-app folder. (It’s the first time I use Cmake, so I’m a bit lost, but I assumed it was the thing to do)
so, here were my first results :

Capture du 2019-05-03 17-27-27.png866×634 106 KB

afterward, I added
set(TORCH_LIBRARY /home/mathieu/Thales/example-app/libtorch/lib/libtorch.so) to my MakeList.txt, which looked like this :
make_minimum_required(VERSION 3.0 FATAL_ERROR)
project(example-app)

set(TORCH_LIBRARY /home/mathieu/Thales/example-app/libtorch/lib/libtorch.so)
find_package(Torch REQUIRED)

add_executable(example-app example-app.cpp)
target_link_libraries(example-app "${TORCH_LIBRARIES}")
set_property(TARGET example-app PROPERTY CXX_STANDARD 11)

new result was such :
cmake -DCMAKE_PREFIX_PATH=$PWD/libtorch
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found torch: /home/mathieu/Thales/example-app/libtorch/lib/libtorch.so  
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
torch;caffe2_library;C10_LIBRARY
    linked by target "example-app" in directory /home/mathieu/Thales/example-app

-- Configuring incomplete, errors occurred!
See also "/home/mathieu/Thales/example-app/CMakeFiles/CMakeOutput.log".
See also "/home/mathieu/Thales/example-app/CMakeFiles/CMakeError.log".


The others things I tried, but it gave me the exact same results :

putting the MakeList.txt file in the build directory and executing it from there.


adding “set(Torch_DIR /home/mathieu/Thales/example-app/libtorch/share/cmake/Torch)” before the find_package in MakeList.txt


exchanging back and forth  “/home/mathieu/Thales/example-app” and $PWD in various places again and again


voodoo magic


adding “set(CMAKE_PREFIX_PATH /home/mathieu/Thales/example-app/libtorch)” before, then after the find_package

I’m on ubuntu 18.04, using cmake 3.10.2. gcc is 7.3
I’ve been looking for answers on the net for the whole day and even tried on a different computer. I’m running out of ideas, so I hope to find some help here ^^
If otherwise someone have found another tutorial with more details and which works, That would be nice.
Have a nice day !
Mathieu