function(pp_configure_windows_runtime_payloads target_name)
    if(NOT TARGET "${target_name}")
        message(FATAL_ERROR "pp_configure_windows_runtime_payloads target does not exist: ${target_name}")
    endif()

    add_custom_command(TARGET "${target_name}" POST_BUILD
        COMMAND "${CMAKE_COMMAND}" -E copy_directory
            "${CMAKE_CURRENT_SOURCE_DIR}/data"
            "$<TARGET_FILE_DIR:${target_name}>/data"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different
            "${CMAKE_CURRENT_SOURCE_DIR}/libs/bugtrap-client/lib/BugTrapU-x64.dll"
            "$<TARGET_FILE_DIR:${target_name}>/BugTrapU-x64.dll"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different
            "$<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/libs/curl-win/lib/dll-debug-x64/libcurl_debug.dll>$<$<NOT:$<CONFIG:Debug>>:${CMAKE_CURRENT_SOURCE_DIR}/libs/curl-win/lib/dll-release-x64/libcurl.dll>"
            "$<TARGET_FILE_DIR:${target_name}>/"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different
            "${CMAKE_CURRENT_SOURCE_DIR}/libs/libyuv/lib/win/libyuv.dll"
            "$<TARGET_FILE_DIR:${target_name}>/libyuv.dll"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different
            "${CMAKE_CURRENT_SOURCE_DIR}/libs/mp4v2/lib/win/libmp4v2.dll"
            "$<TARGET_FILE_DIR:${target_name}>/libmp4v2.dll"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different
            "${CMAKE_CURRENT_SOURCE_DIR}/libs/openh264/lib/openh264-2.0.0-win64.dll"
            "$<TARGET_FILE_DIR:${target_name}>/openh264-2.0.0-win64.dll"
        COMMAND "${CMAKE_COMMAND}" -E copy_if_different
            "${CMAKE_CURRENT_SOURCE_DIR}/libs/openvr/bin/win64/openvr_api.dll"
            "$<TARGET_FILE_DIR:${target_name}>/openvr_api.dll"
        VERBATIM)
endfunction()
