Compile a model with libtorch locally built from the source

Happy new year!

I built libtorch locally by following this instruction.
However, I’m having trouble to use this to compile models.

I changed my CMakeLists.txt as follows:

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(example-app)

set(CMAKE_PREFIX_PATH "~/pytorch/build_libtorch/build")

find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

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

When running the cmake, I meet bunch of errors like following:

CMake Error at /home/spark/pytorch/build_libtorch/build/Caffe2Config.cmake:14 (include):
  include could not find requested file:

    /home/spark/pytorch/build_libtorch/build/public/utils.cmake
Call Stack (most recent call first):
  /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/Caffe2Config.cmake:17 (include):
  include could not find requested file:

    /home/spark/pytorch/build_libtorch/build/public/threads.cmake
Call Stack (most recent call first):
  /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/Caffe2Config.cmake:92 (include):
  include could not find requested file:

    /home/spark/pytorch/build_libtorch/build/public/cuda.cmake
Call Stack (most recent call first):
  /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/Caffe2Config.cmake:113 (include):
  include could not find requested file:

    /home/spark/pytorch/build_libtorch/build/public/mkl.cmake
Call Stack (most recent call first):
  /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/Caffe2Config.cmake:116 (include):
  include could not find requested file:

    /home/spark/pytorch/build_libtorch/build/public/mkldnn.cmake
Call Stack (most recent call first):
  /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/Caffe2Config.cmake:120 (include):
  include could not find requested file:

    /home/spark/pytorch/build_libtorch/build/Caffe2Targets.cmake
Call Stack (most recent call first):
  /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:68 (find_package)
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:182 (set_target_properties):
  set_target_properties Can not find target to add properties to: torch
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)


CMake Error at /home/spark/pytorch/build_libtorch/build/TorchConfig.cmake:187 (set_property):
  set_property could not find TARGET torch.  Perhaps it has not yet been
  created.
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)

I suspect the official release of libtorch does some kind of tricks that the build instruction does not provide.
I would appreciate any help or advice.
Thank you!

Update: Tried build with cmake as well but still does not generate public/ directory.