myx/MyxCMake/lib/SemanticProjectVersion.cmake

18 lines
548 B
CMake
Raw Normal View History

2022-09-28 23:46:29 +00:00
include_guard(GLOBAL)
function(myx_is_semantic_project_version)
if(NOT ${PROJECT_VERSION_PATCH} MATCHES "([0-9]+)")
myx_message_error("Myx: Please set project version in X.Y.Z format")
endif()
endfunction()
function(myx_project_version_int)
# cmake-format: off
myx_is_semantic_project_version()
math(EXPR v "(${PROJECT_VERSION_MAJOR} << 32) + (${PROJECT_VERSION_MINOR} << 16) + ${PROJECT_VERSION_PATCH}")
set_property(GLOBAL PROPERTY PROJECT_VERSION_INT ${v})
# cmake-format: on
endfunction()
2022-09-29 11:34:59 +00:00
myx_is_semantic_project_version()