# Read version from include/version.h file
function(read_version)
    file(READ "${CMAKE_CURRENT_LIST_DIR}/include/version.h" VERSION_FILE)

    string(REGEX MATCH "ACS_VERSION_MAJOR ([0-9]*)" _ ${VERSION_FILE})
    set(VERSION_MAJOR ${CMAKE_MATCH_1})
    set(CMAKE_PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1} PARENT_SCOPE)

    string(REGEX MATCH "ACS_VERSION_MINOR ([0-9]*)" _ ${VERSION_FILE})
    set(VERSION_MINOR ${CMAKE_MATCH_1})
    set(CMAKE_PROJECT_VERSION_MINOR ${CMAKE_MATCH_1} PARENT_SCOPE)

    string(REGEX MATCH "ACS_VERSION_PATCH ([0-9]*)" _ ${VERSION_FILE})
    set(VERSION_PATCH ${CMAKE_MATCH_1})
    set(CMAKE_PROJECT_VERSION_PATCH ${CMAKE_MATCH_1} PARENT_SCOPE)

    set(CMAKE_PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}
            PARENT_SCOPE)
endfunction()
