Skip to content

Commit

Permalink
fix GIT_HASH
Browse files Browse the repository at this point in the history
  • Loading branch information
PonomarevDA committed Dec 25, 2023
1 parent 55b7605 commit 37f232d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ add_custom_command(TARGET ${EXECUTABLE}
COMMAND arm-none-eabi-size ${EXECUTABLE}
)

execute_process(
COMMAND git rev-parse --short=16 HEAD
COMMAND_ERROR_IS_FATAL ANY
OUTPUT_VARIABLE GIT_HASH_SHORT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(GIT_HASH "0x${GIT_HASH_SHORT}")
add_definitions(-DGIT_HASH=${GIT_HASH})

add_custom_command(TARGET ${EXECUTABLE}
POST_BUILD
COMMAND arm-none-eabi-objcopy -O ihex ${EXECUTABLE} ${PROJECT_NAME}.hex
Expand Down

0 comments on commit 37f232d

Please sign in to comment.