]> OCCT Git - occt.git/commitdiff
Configuration - Git commit info missed #323
authorPasukhin Dmitry <dpasukhi@opencascade.com>
Sat, 1 Feb 2025 17:16:58 +0000 (18:16 +0100)
committerGitHub <noreply@github.com>
Sat, 1 Feb 2025 17:16:58 +0000 (17:16 +0000)
Fixed issue with missed git info as a part of dev version.
Add option to enable/disable git hash extraction in version string.

adm/cmake/occt_macros.cmake

index d6bc06ee90e9d15c3074ab2812f5ea638130e1ac..92a8db33dc118b52e403ccd4c752171404388dfa 100644 (file)
@@ -638,14 +638,25 @@ function (OCC_VERSION OCC_VERSION_MAJOR OCC_VERSION_MINOR OCC_VERSION_MAINTENANC
   
   set (SET_OCC_VERSION_DEVELOPMENT "")
   if (${OCCT_ON_DEVELOPMENT})
-    OCCT_GET_GIT_HASH()
+    # Use special flag from cache to turn on or off git hash extraction
+    if (NOT DEFINED USE_GIT_HASH)
+      set (USE_GIT_HASH ON CACHE BOOL "Use git hash in version string")
+    endif()
+    if (${USE_GIT_HASH})
+      OCCT_GET_GIT_HASH()
+    endif()
     if (NOT "${GIT_HASH}" STREQUAL "")
       set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}-${GIT_HASH}")
       set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
+    else()
+      set (OCC_VERSION_DEVELOPMENT "${OCC_VERSION_DEVELOPMENT}")
     endif()
     set (OCC_VERSION_STRING_EXT "${OCC_VERSION_COMPLETE}.${OCC_VERSION_DEVELOPMENT}")
     set (OCC_VERSION_STRING_EXT "${OCC_VERSION_STRING_EXT}" PARENT_SCOPE)
     set (SET_OCC_VERSION_DEVELOPMENT "#define OCC_VERSION_DEVELOPMENT \"${OCC_VERSION_DEVELOPMENT}\"")
+    set (SET_OCC_VERSION_DEVELOPMENT "${SET_OCC_VERSION_DEVELOPMENT}" PARENT_SCOPE)
+  else()
+    OCCT_CHECK_AND_UNSET(USE_GIT_HASH)
   endif()
   set (OCC_VERSION_STRING_EXT "${OCC_VERSION_STRING_EXT}" PARENT_SCOPE)
 endfunction()