Skip to content

Commit

Permalink
cmake: find GIT_VER variables if there is no .git dir
Browse files Browse the repository at this point in the history
find CEPH_GIT_VER & CEPH_GIT_NICE_VER if there is no
ceph/.git dir by parsing ceph/src/.git_version.

scenario is for building from source tarballs generated
by make-dist, since make-dist generates .git_version
by running make_version, and then packs .git_version
into the tarball.

Signed-off-by: Ali Maredia <[email protected]>
  • Loading branch information
alimaredia committed Oct 14, 2016
1 parent 676cd29 commit c5c6b59
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ option(ENABLE_GIT_VERSION "build Ceph with git version string" ON)
if(${ENABLE_GIT_VERSION})
get_git_head_revision(GIT_REFSPEC CEPH_GIT_VER)
git_describe(CEPH_GIT_NICE_VER --always)
#if building from a source tarball via make-dist
if(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
message(STATUS "Ceph/.git directory not found, parsing ${CMAKE_CURRENT_SOURCE_DIR}/.git_version for CEPH_GIT_VER and CEPH_GIT_NICE_VER")
file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/.git_version CEPH_GIT_SHA_AND_TAG)
list(GET CEPH_GIT_SHA_AND_TAG 0 CEPH_GIT_VER)
list(GET CEPH_GIT_SHA_AND_TAG 1 CEPH_GIT_NICE_VER)
endif(${CEPH_GIT_VER} STREQUAL "GITDIR-NOTFOUND")
else(${ENABLE_GIT_VERSION})
set(CEPH_GIT_VER "no_version")
set(CEPH_GIT_NICE_VER "Development")
Expand Down

0 comments on commit c5c6b59

Please sign in to comment.