Skip to content

Commit

Permalink
Merge pull request #19 from eternalharvest/feature/support_tarball_re…
Browse files Browse the repository at this point in the history
…lease

リリースアーカイブからのビルド時にもバージョン情報を埋め込み
  • Loading branch information
stz2012 authored Aug 14, 2018
2 parents b7610da + f29afbf commit f6fbf0c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmake/GitRevision.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
find_package(Git)
if(GIT_FOUND)
if(GIT_FOUND AND IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --always
COMMAND ${GIT_EXECUTABLE} describe --always --tags
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand All @@ -17,6 +17,10 @@ if(GIT_FOUND)
set(GIT_REVISION "${GIT_REVISION} dirty")
endif()
else()
set(GIT_REVISION "n/a")
if (EXISTS ${CMAKE_SOURCE_DIR}/.tarball-version)
file(STRINGS ${CMAKE_SOURCE_DIR}/.tarball-version GIT_REVISION LIMIT_COUNT 1)
else()
set(GIT_REVISION "Unknown Source")
endif()
set(GIT_IS_DIRTY False)
endif()

0 comments on commit f6fbf0c

Please sign in to comment.