From c7546efe3c4f2492ed55171c1d41d1c843cedbeb Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov@tarantool.org> Date: Tue, 14 Dec 2021 10:55:54 +0300 Subject: [PATCH] cmake: take git version from main project Use git from CMAKE_SOURCE_DIR instead of PROJECT_SOURCE_DIR so that if Tarantool is built as a sub-project, we will use the version of the main project. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cfecbe8e5..381a744f97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -239,11 +239,11 @@ endif() # avoids git to search .git repository in parent # directories. # -if (EXISTS "${PROJECT_SOURCE_DIR}/.git" AND GIT) +if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT) execute_process (COMMAND ${GIT} describe --long HEAD OUTPUT_VARIABLE TARANTOOL_GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) if (NOT ("${TARANTOOL_GIT_VERSION}" STREQUAL "${TARANTOOL_VERSION}")) set(TARANTOOL_VERSION "${TARANTOOL_GIT_VERSION}") -- GitLab