function(raygun_set_source_groups target)
    get_target_property(sources ${target} SOURCES)
    get_target_property(target_dir ${target} SOURCE_DIR)
    foreach(source IN LISTS sources)
        get_filename_component(source_dir ${source} DIRECTORY)
        file(RELATIVE_PATH group ${target_dir} ${source_dir})
        string(REPLACE "/" "\\" group "${group}")
        source_group("Source Files\\${group}" FILES ${source})
    endforeach()
endfunction()
