diff options
author | Biswapriyo Nath <nathbappai@gmail.com> | 2021-12-11 05:10:21 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 15:40:21 -0800 |
commit | b92bb0584d056cd237fa7059702e49617ee156b7 (patch) | |
tree | c87164df2e05251169e143f8afc64271c5fbeebd /CMake | |
parent | 956d11569ec0a901041939befe01a7e2af18e604 (diff) | |
download | flatbuffers-b92bb0584d056cd237fa7059702e49617ee156b7.tar.gz flatbuffers-b92bb0584d056cd237fa7059702e49617ee156b7.tar.bz2 flatbuffers-b92bb0584d056cd237fa7059702e49617ee156b7.zip |
[CMake]: Fix version in pkgconfig file (#6986)
This change checks if the current source directory is a git repository.
If this is not checked the git command picks the commit hash from
parent directory. e.g. when tarball is extracted in a packaging repository.
Diffstat (limited to 'CMake')
-rw-r--r-- | CMake/Version.cmake | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/CMake/Version.cmake b/CMake/Version.cmake index 526323da..147de5e3 100644 --- a/CMake/Version.cmake +++ b/CMake/Version.cmake @@ -4,7 +4,7 @@ set(VERSION_PATCH 5) set(VERSION_COMMIT 0) find_program(GIT git) -if(GIT) +if(GIT AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") execute_process( COMMAND ${GIT} describe --tags WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |