build: use git-describe with just .git / add 'Using version from …' msg (#1302)
With Git submodules there is only a `.git` file typically, e.g.: > gitdir: /home/user/Vcs/awesome-www/.git/modules/src
This commit is contained in:
parent
58fed31d88
commit
fdc93e68da
|
@ -87,7 +87,8 @@ endif()
|
||||||
# {{{ Version stamp
|
# {{{ Version stamp
|
||||||
if(OVERRIDE_VERSION)
|
if(OVERRIDE_VERSION)
|
||||||
set(VERSION ${OVERRIDE_VERSION})
|
set(VERSION ${OVERRIDE_VERSION})
|
||||||
elseif(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
|
message(STATUS "Using version from OVERRIDE_VERSION: ${VERSION}")
|
||||||
|
elseif(EXISTS ${SOURCE_DIR}/.git AND GIT_EXECUTABLE)
|
||||||
# get current version
|
# get current version
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} describe --dirty
|
COMMAND ${GIT_EXECUTABLE} describe --dirty
|
||||||
|
@ -99,9 +100,11 @@ elseif(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE)
|
||||||
file(WRITE ${VERSION_STAMP_FILE} ${VERSION})
|
file(WRITE ${VERSION_STAMP_FILE} ${VERSION})
|
||||||
# create a version_stamp target later
|
# create a version_stamp target later
|
||||||
set(BUILD_FROM_GIT TRUE)
|
set(BUILD_FROM_GIT TRUE)
|
||||||
|
message(STATUS "Using version from git: ${VERSION}")
|
||||||
elseif( EXISTS ${SOURCE_DIR}/.version_stamp )
|
elseif( EXISTS ${SOURCE_DIR}/.version_stamp )
|
||||||
# get version from version stamp
|
# get version from version stamp
|
||||||
file(READ ${SOURCE_DIR}/.version_stamp VERSION)
|
file(READ ${SOURCE_DIR}/.version_stamp VERSION)
|
||||||
|
message(STATUS "Using version from ${SOURCE_DIR}/.version_stamp: ${VERSION}")
|
||||||
endif()
|
endif()
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue