function(CopyResourcesToExe TARGET FROM EXTENSIONS)
    file(GLOB RESOURCES "${FROM}/*")
    set(RESOURCES_TO_COPY "")

    if (${EXTENSIONS} STREQUAL "*")
        set(RESOURCES_TO_COPY ${RESOURCES})
    else()
        foreach(RESOURCE ${RESOURCES})
            get_filename_component(EXT "${RESOURCE}" EXT)
            list(FIND EXTENSIONS ${EXT} EXT_FOUND)
            if(NOT EXT_FOUND EQUAL -1)
                list(APPEND RESOURCES_TO_COPY "${RESOURCE}")
            endif()
        endforeach()
    endif()

    foreach(RESOURCE ${RESOURCES_TO_COPY})
        add_custom_command(TARGET ${TARGET} POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
            ${RESOURCE} $<TARGET_FILE_DIR:${TARGET}>
        )
    endforeach()
endfunction()