include_guard(GLOBAL) function(myx_cmake_check_project_version) if(NOT ${PROJECT_VERSION_PATCH} MATCHES "([0-9]+)") myx_cmake_message_error("MyxCMake: Please set project version in X.Y.Z format") endif() endfunction() function(myx_cmake_set_project_version_int) # cmake-format: off myx_cmake_check_project_version() math(EXPR _version_int "(${PROJECT_VERSION_MAJOR} << 16) + (${PROJECT_VERSION_MINOR} << 8) + ${PROJECT_VERSION_PATCH}") set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${_version_int}) # cmake-format: on endfunction() myx_cmake_set_project_version_int()