GenerateVersion.cmake 593 B

1234567891011121314151617181920
  1. # Always run during 'make'
  2. if(VERSION_EXTRA)
  3. set(VERSION_GITHASH "${VERSION_STRING}")
  4. else(VERSION_EXTRA)
  5. execute_process(COMMAND git describe --always --tag --dirty
  6. WORKING_DIRECTORY "${GENERATE_VERSION_SOURCE_DIR}"
  7. OUTPUT_VARIABLE VERSION_GITHASH OUTPUT_STRIP_TRAILING_WHITESPACE
  8. ERROR_QUIET)
  9. if(VERSION_GITHASH)
  10. message(STATUS "*** Detected git version ${VERSION_GITHASH} ***")
  11. else()
  12. set(VERSION_GITHASH "${VERSION_STRING}")
  13. endif()
  14. endif()
  15. configure_file(
  16. ${GENERATE_VERSION_SOURCE_DIR}/cmake_config_githash.h.in
  17. ${GENERATE_VERSION_BINARY_DIR}/cmake_config_githash.h)