flatbuffers icon indicating copy to clipboard operation
flatbuffers copied to clipboard

CMake Warning at CMake/Version.cmake (git)

Open heitbaum opened this issue 3 years ago • 0 comments

https://github.com/google/flatbuffers/blob/c92e78a9f841a6110ec27180d68d1f7f2afda21d/CMake/Version.cmake#L6-L7

in the above file the git program is trying to be found and gives the following warning.

CMake Warning at CMake/Version.cmake:34 (message):
  git is not found
Call Stack (most recent call first):
  CMakeLists.txt:19 (include)

It could be rewritten to check for .git directory first.

something like.

--- a/CMake/Version.cmake       2022-09-30 05:12:07.000000000 +0000
+++ b/CMake/Version.cmake       2022-10-01 09:55:50.558512962 +0000
@@ -3,8 +3,9 @@
 set(VERSION_PATCH 29)
 set(VERSION_COMMIT 0)
 
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
 find_program(GIT git)
-if(GIT AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
+if(GIT)
   execute_process(
       COMMAND ${GIT} describe --tags
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@@ -33,5 +34,6 @@
 else()
   message(WARNING "git is not found")
 endif()
+endif()
 
 message(STATUS "Proceeding with version: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_COMMIT}")

heitbaum avatar Oct 01 '22 09:10 heitbaum