# Set up version numbers according to the new scheme.
set(SM_VERSION_MAJOR 5)
set(SM_VERSION_MINOR 2)
set(SM_VERSION_PATCH 0)
set(SM_VERSION_TRADITIONAL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}")

find_program(HAS_GIT_ON_PATH git)
mark_as_advanced(FORCE HAS_GIT_ON_PATH)

math(EXPR SM_BITS "8 * ${CMAKE_SIZEOF_VOID_P}")

# Build the version strings appropriately.
if (NOT HAS_GIT_ON_PATH)
  set(SM_VERSION_GIT_HASH "UNKNOWN")
  set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-${SM_VERSION_GIT_HASH}")
  set(SM_VERSION_GIT "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-${SM_VERSION_GIT_HASH}")
else()
  execute_process(COMMAND git rev-parse --short HEAD
    WORKING_DIRECTORY "${SM_ROOT_DIR}"
    OUTPUT_VARIABLE SM_VERSION_GIT_HASH
    RESULT_VARIABLE ret
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
  if (WITH_FULL_RELEASE)
    set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}")
    set(SM_VERSION_GIT "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}.${SM_VERSION_PATCH}")
  else()
    set(SM_VERSION_FULL "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-git-${SM_VERSION_GIT_HASH}")
    set(SM_VERSION_GIT "${SM_VERSION_MAJOR}.${SM_VERSION_MINOR}-git-${SM_VERSION_GIT_HASH}")
  endif()
endif()

# Get timestamps appropriately.
string(TIMESTAMP SM_TIMESTAMP_DATE "%Y%m%d")
string(TIMESTAMP SM_TIMESTAMP_TIME "%H:%M:%S" UTC)
