VersionConfiguration.cmake 978 B

123456789101112131415161718192021222324252627282930
  1. # Get the current date.
  2. include(GetDate)
  3. include(WebClientVariables)
  4. today(CURRENT_DATE)
  5. # Get git revision version
  6. include(GetGitRevisionDescription)
  7. get_git_head_revision(REFSPEC FULL_GIT_REVISION)
  8. if(FULL_GIT_REVISION STREQUAL "GITDIR-NOTFOUND")
  9. set(GIT_REVISION "git")
  10. else(FULL_GIT_REVISION STREQUAL "GITDIR-NOTFOUND")
  11. string(SUBSTRING ${FULL_GIT_REVISION} 0 8 GIT_REVISION)
  12. endif(FULL_GIT_REVISION STREQUAL "GITDIR-NOTFOUND")
  13. # Get the build number if available
  14. if(DEFINED ENV{BUILD_NUMBER})
  15. set(VERSION_BUILD "$ENV{BUILD_NUMBER}")
  16. set(VERSION_BUILD_NR "$ENV{BUILD_NUMBER}")
  17. else()
  18. set(VERSION_BUILD "dev")
  19. set(VERSION_BUILD_NR "0")
  20. endif()
  21. set(VERSION_MAJOR 1)
  22. set(VERSION_MINOR 0)
  23. set(VERSION_NANO 3)
  24. set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_NANO}.${VERSION_BUILD}-${GIT_REVISION}")
  25. set(CANONICAL_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_NANO}-${GIT_REVISION}")
  26. configure_file(src/Version.cpp.in src/Version.cpp)