You mean like this？
python setup.py build

cd build

cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch ..

cd ..

python setup.py install

This is very troublesome，and when I exec python setup.py install，It also compiles some files