function(filterEngineSources LIST)
    foreach(FILE ${LIST})
        get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
        string(REPLACE "${CMAKE_SOURCE_DIR}" "" GROUP "${PARENT_DIR}")
        string(REPLACE "/" "\\" GROUP "${GROUP}")
        set(GROUP "${FOLDER}MidnightEngine${GROUP}")
        source_group("${GROUP}" FILES "${FILE}")
    endforeach()
endfunction()

function(filterThirdPartySources LIST)
    foreach(FILE ${LIST})

        get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
        string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" GROUP "${PARENT_DIR}")

        if(${GROUP} STREQUAL ${PARENT_DIR})
            string(REPLACE "${CMAKE_SOURCE_DIR}" "" GROUP "${PARENT_DIR}")
            string(REPLACE "Source/" "" GROUP "${GROUP}")
        endif()

        string(REPLACE "Source/" "" GROUP "${GROUP}")
        string(REPLACE "/" "\\" GROUP "${GROUP}")
        set(GROUP "${FOLDER}MidnightEngine/Source${GROUP}")
        source_group("${GROUP}" FILES "${FILE}")

    endforeach()
endfunction()

function(filterAppSources LIST)
    foreach(FILE ${LIST})
        get_filename_component(PARENT_DIR "${FILE}" DIRECTORY)
        string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" GROUP "${PARENT_DIR}")
        string(REPLACE "/" "\\" GROUP "${GROUP}")
        set(GROUP "${FOLDER}MidnightApp${GROUP}")
        source_group("${GROUP}" FILES "${FILE}")
    endforeach()
endfunction()