mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-29 01:56:27 +00:00
[cmake] replace git diff logic with git describe --dirty
The --dirty argument of git describe performs the same function as the now-removed git diff logic. It will add its argument (default '-dirty') to the end of the revision. Providing '+' as the argument replicates old behavior.
This commit is contained in:
parent
9f787777b5
commit
57a5488ac2
@ -1,26 +1,18 @@
|
|||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git describe --always --long --abbrev=10 --tags
|
COMMAND git describe --always --long --abbrev=10 --dirty=+ --tags
|
||||||
WORKING_DIRECTORY "${PROJECT_TOP}"
|
WORKING_DIRECTORY "${PROJECT_TOP}"
|
||||||
OUTPUT_VARIABLE GIT_REV
|
OUTPUT_VARIABLE GIT_REV
|
||||||
ERROR_QUIET)
|
ERROR_QUIET)
|
||||||
|
|
||||||
if (NOT "${GIT_REV}" STREQUAL "")
|
if ("${GIT_REV}" STREQUAL "")
|
||||||
execute_process(
|
|
||||||
COMMAND bash -c "git diff --quiet --exit-code && git diff --cached --quiet --exit-code || echo +"
|
|
||||||
WORKING_DIRECTORY "${PROJECT_TOP}"
|
|
||||||
OUTPUT_VARIABLE GIT_DIFF)
|
|
||||||
else()
|
|
||||||
if (EXISTS ${PROJECT_TOP}/VERSION)
|
if (EXISTS ${PROJECT_TOP}/VERSION)
|
||||||
file(READ ${PROJECT_TOP}/VERSION GIT_REV)
|
file(READ ${PROJECT_TOP}/VERSION GIT_REV)
|
||||||
else()
|
else()
|
||||||
set(GIT_REV "UNKNOWN")
|
set(GIT_REV "UNKNOWN")
|
||||||
set(GIT_DIFF "")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
string(STRIP "${GIT_REV}" GIT_REV)
|
string(STRIP "${GIT_REV}" GIT_VERSION)
|
||||||
string(STRIP "${GIT_DIFF}" GIT_DIFF)
|
|
||||||
set(GIT_VERSION "${GIT_REV}${GIT_DIFF}")
|
|
||||||
set(BUILD_VERSION "const char * BUILD_VERSION = \"${GIT_VERSION}\";")
|
set(BUILD_VERSION "const char * BUILD_VERSION = \"${GIT_VERSION}\";")
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_BINARY_DIR}/version.c")
|
if(EXISTS "${CMAKE_BINARY_DIR}/version.c")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user