How to add an install target for libtorch binaries in cmake?

this question is about using the install command in CMakeLists to place+link the libtorch shared libraries in a relocatable way. Is there a proper way to do this with the libtorch cmake module?

I figured either

install(TARGETS ${TORCH_LIBRARIES} DESTINATION /path/to/install)

or

install(FILES ${TORCH_LIBRARIES} DESTINATION /path/to/install)

but each causes an error, because TORCH_LIBRARIES contains both targets and filenames? In this case it is torch;torch_library;/Users/victor/libtorch-1_11_0_dev20220110/lib/libc10.dylib;/Users/victor/libtorch-1_11_0_dev20220110/lib/libkineto.a

I think I know how to do this manually on macOS, but I would like cmake to handle it for all platforms + in a forward-compatible way.