What are the "correct" CMake settings to compile the PyTorch?

Hi Everyone!
I would like to compile a custom version of the PyTorch. Could someone kindly tell me, what are the “safe” CMake settings that guarantee a successful compilation? In particular, we would like to use CUDA 12.1.
Thanks!
Piotr

You can just stick to the build instructions on GitHub, which should not use any custom cmake settings.

I use this and it works right will download torch automatically


set(Torch_DIR ${TORCH_INSTALL_DIR}/share/cmake/Torch)
Set(FETCHCONTENT_QUIET FALSE)
FetchContent_Declare(
  Torch
  URL       ${TORCH_URL}
  URL_HASH   MD5=${URL_HASH}
  SOURCE_DIR ${TORCH_INSTALL_DIR}
  OVERRIDE_FIND_PACKAGE
  DOWNLOAD_EXTRACT_TIMESTAMP
)
FetchContent_Populate(Torch)


find_package(Torch REQUIRED)