set(PR_COPY_ASSET_INDEX 0 CACHE INTERNAL "")

function(PrCopyAsset)
    math(EXPR IDX_TMP "${PR_COPY_ASSET_INDEX} + 1")
    set(PR_COPY_ASSET_INDEX ${IDX_TMP} CACHE INTERNAL "")

    cmake_parse_arguments(
        CPY
        ""
        "IN;OUT;TARGET"
        ""
        ${ARGN}
    )

    get_filename_component(DIR ${CPY_OUT} DIRECTORY)
    file(MAKE_DIRECTORY ${DIR})

    get_filename_component(FNAME ${CPY_IN} NAME)
    string(MAKE_C_IDENTIFIER "${FNAME}" ASSET_NAME)

    set(TARGET_NAME "CompileShader-${ASSET_NAME}-${PR_COPY_ASSET_INDEX}")

    add_custom_target(${TARGET_NAME}
        COMMAND ${CMAKE_COMMAND} -E copy ${CPY_IN} ${CPY_OUT}
        COMMENT "Copy asset: ${CPY_IN}"
    )

    add_dependencies(${CPY_TARGET} ${TARGET_NAME})
endfunction()