[CMake]: Fix version in pkgconfig file (#6986)
[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.
alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers