From c5c6b59f296f0ace3a6cfd939027118e82ab50a4 Mon Sep 17 00:00:00 2001 From: Ali Maredia Date: Fri, 14 Oct 2016 14:02:17 -0400 Subject: [PATCH] cmake: find GIT_VER variables if there is no .git dir 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 --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index caab0a37cd3..34ca3c1a826 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") -- 2.47.3