mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
cmake: handle the scenario of a commit having more than 1 tag (#3662)
Some checks failed
Build / 🖥️ Windows (push) Has been cancelled
Build / 🐧 Linux (push) Has been cancelled
Build / 🍎 MacOS (push) Has been cancelled
Lint / 📝 Formatting (push) Has been cancelled
Lint / 📝 Required Checks (push) Has been cancelled
Lint / 📝 Optional Checks (push) Has been cancelled
Some checks failed
Build / 🖥️ Windows (push) Has been cancelled
Build / 🐧 Linux (push) Has been cancelled
Build / 🍎 MacOS (push) Has been cancelled
Lint / 📝 Formatting (push) Has been cancelled
Lint / 📝 Required Checks (push) Has been cancelled
Lint / 📝 Optional Checks (push) Has been cancelled
This commit is contained in:
parent
69d879f901
commit
431508aab1
|
@ -15,6 +15,13 @@ function(write_revision_h)
|
||||||
OUTPUT_VARIABLE GIT_TAG
|
OUTPUT_VARIABLE GIT_TAG
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
ERROR_QUIET)
|
ERROR_QUIET)
|
||||||
|
# To support being on a commit with mutiple tags
|
||||||
|
if(${GIT_TAG} MATCHES "\n")
|
||||||
|
string(REPLACE "\n" ";" GIT_TAG_LIST "${GIT_TAG}")
|
||||||
|
list(LENGTH GIT_TAG_LIST GIT_TAG_LIST_LENGTH)
|
||||||
|
math(EXPR GIT_TAG_LAST_INDEX "${GIT_TAG_LIST_LENGTH} - 1")
|
||||||
|
list(GET GIT_TAG_LIST ${GIT_TAG_LAST_INDEX} GIT_TAG)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/versions/revision.h "#define BUILT_TAG \"${GIT_TAG}\"\n#define BUILT_SHA \"${GIT_SHORT_SHA}\"\n")
|
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/versions/revision.h "#define BUILT_TAG \"${GIT_TAG}\"\n#define BUILT_SHA \"${GIT_SHORT_SHA}\"\n")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
Loading…
Reference in a new issue