set(PR_ASSETDEF_INDEX 0 CACHE INTERNAL "")

function(PrAssetDef)

    math(EXPR IDX_TMP "${PR_ASSETDEF_INDEX} + 1")
    set(PR_ASSETDEF_INDEX ${IDX_TMP} CACHE INTERNAL "")

    cmake_parse_arguments(
        CADEF
        ""
        "IN;OUT;TARGET"
        ""
        ${ARGN}
    )
    file(MAKE_DIRECTORY ${CADEF_OUT})

    get_filename_component(CADEF_NAME "${CADEF_IN}" NAME_WLE)
    string(MAKE_C_IDENTIFIER "${CADEF_NAME}" ASSETDEF_NAME)

    set(TARGET_NAME "CompileAssetDef-${ASSETDEF_NAME}-${PR_ASSETDEF_INDEX}")
    set(SHADER_LIB_DIR "${PR_ENGINE_ASSETS_DIR}/ShaderLib")
    add_custom_target(${TARGET_NAME}
        COMMAND AssetUtility -t def -I ${SHADER_LIB_DIR} -i ${CADEF_IN} -o ${CADEF_OUT}
        COMMENT "Compiling asset: ${CADEF_NAME}"
        VERBATIM
    )
    add_dependencies(${CADEF_TARGET} ${TARGET_NAME})
endfunction()