According to the docs, IMPORTED_LOCATION should be set to the .dll part of the library. I have found that it is not necessary. However the DLL does need to be in an appropriate location such as ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE} at runtime. In that case, why are we advised to set IMPORTED_LOCATION?
I tried deleting the DLLs from ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE} and the code which copied them from the imported library and then set the IMPORTED_LOCATION to the DLLs from the imported library, see the new script. It builds successfully but when I run the executable aten_libtorch.exe, I receive pop out System Error messages - The code execution cannot proceed because c10.dll/torch_cpu was not found. So what is the benefit of setting IMPORTED_LOCATION?