You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GetCurrentVersion.cmake 731B

12345678910111213141516171819
  1. # ---------------------------------
  2. # create CMake variables that holds
  3. # - latest git commit hash
  4. # - branch name
  5. # ---------------------------------
  6. # codename = the name of the current branch
  7. EXECUTE_PROCESS(COMMAND git rev-parse --abbrev-ref HEAD
  8. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  9. OUTPUT_VARIABLE PROJECT_BRANCH)
  10. # command output may contain carriage return
  11. STRING(REGEX REPLACE "\n" "" PROJECT_BRANCH "${PROJECT_BRANCH}")
  12. # commithash = short hash of latest revision
  13. EXECUTE_PROCESS(COMMAND git rev-parse --short HEAD
  14. WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
  15. OUTPUT_VARIABLE PROJECT_COMMITHASH)
  16. # command output may contain carriage return
  17. STRING(REGEX REPLACE "\n" "" PROJECT_COMMITHASH "${PROJECT_COMMITHASH}")