CMake 3.16 has file(GET_RUNTIME_DEPENDENCIES) that you can use for this.
file(GET_RUNTIME_DEPENDENCIES)