CMake project version detection made more robust (#7473)
CMake project version detection made more robust (#7473)

This fixes two problems:
1. The project could be build when using own tags which does not follow the pattern v<major>.<minor>.<patch>.
2. The case "tag points to the commit" will be handled correctly by setting VERSION_COMMIT to 0.

This commit resolves https://github.com/google/flatbuffers/issues/7472

Co-authored-by: Axel Sommerfeldt <8cccd0c4902e524a5f12de098fe5e96aa9b129cb@gmail.com>
alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers,alexames/flatbuffers,alexames/flatbuffers,google/flatbuffers,alexames/flatbuffers,google/flatbuffers,google/flatbuffers