file(READ ${CMAKE_SOURCE_DIR}/include/latino.h _LATINO_H_CONTENTS)

string(REGEX MATCH "#define LAT_VERSION_MAYOR   ([a-zA-Z0-9_]+)" LAT_VER_MAYOR "${_LATINO_H_CONTENTS}")
string(REPLACE "#define LAT_VERSION_MAYOR   " "" LAT_VER_MAYOR "${LAT_VER_MAYOR}")

string(REGEX MATCH "#define LAT_VERSION_MENOR   ([a-zA-Z0-9_]+)" LAT_VER_MENOR "${_LATINO_H_CONTENTS}")
string(REPLACE "#define LAT_VERSION_MENOR   " "" LAT_VER_MENOR "${LAT_VER_MENOR}")

string(REGEX MATCH "#define LAT_VERSION_PARCHE  ([a-zA-Z0-9_]+)" LAT_VER_PARCHE "${_LATINO_H_CONTENTS}")
string(REPLACE "#define LAT_VERSION_PARCHE  " "" LAT_VER_PARCHE "${LAT_VER_PARCHE}")

if(BUILD_NUMBER)
    set(LATINO_VERSION ${LAT_VER_MAYOR}.${LAT_VER_MENOR}.${LAT_VER_PARCHE}.${BUILD_NUMBER})
else()
    set(LATINO_VERSION ${LAT_VER_MAYOR}.${LAT_VER_MENOR}.${LAT_VER_PARCHE}.0)
endif()