summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
6c0e9e4)
Added the short hash coming from git lastest git commit
to the version number. In addition of the dirty flag
it make possible to know from where modifications
divergences begin.
Change-Id: Id25256f896c8179009d8588f79e7801cc2c90821
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
OUTPUT_STRIP_TRAILING_WHITESPACE
)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
+# Get the git commit hash to append to the version
+execute_process(COMMAND git rev-parse --short HEAD
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE COMMIT_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+)
+
# Detect unstaged or untracked changes
execute_process(COMMAND git status --short
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
# Detect unstaged or untracked changes
execute_process(COMMAND git status --short
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
# attributes then add the dirty flag if git repo not sync'ed
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
if(NOT ${DIRTY_FLAG})
# attributes then add the dirty flag if git repo not sync'ed
project(${PROJECT_NAME} VERSION ${PROJECT_VERSION} LANGUAGES ${PROJECT_LANGUAGES})
if(NOT ${DIRTY_FLAG})
-set(PROJECT_VERSION "${PROJECT_VERSION}-dirty")
+ set(PROJECT_VERSION "${PROJECT_VERSION}-${COMMIT_HASH}-dirty")
+else()
+ set(PROJECT_VERSION "${PROJECT_VERSION}-${COMMIT_HASH}")
endif()
set(AFB_TOKEN "" CACHE PATH "Default AFB_TOKEN")
endif()
set(AFB_TOKEN "" CACHE PATH "Default AFB_TOKEN")