Try setting this flag "-D_GLIBCXX_USE_CXX11_ABI=0" with CMake.
If you are passing a relative path to the libtorch in CMake, make sure you have the $PWD in the path:
cmake -DCMAKE_PREFIX_PATH=$PWD/../relative/path/to/libtorch ..