Warning, /epic/cmake/git_version.cmake is written in an unsupported language. File is not indexed.
0001 # Determine version from git describe cmake-lint: disable=C0103
0002 macro(set_git_version VERSION)
0003 if(NOT Git_Found)
0004 find_package(Git)
0005 endif()
0006
0007 if(GIT_EXECUTABLE)
0008 # Generate a git-describe version string from Git repository tags
0009 execute_process(
0010 COMMAND ${GIT_EXECUTABLE} describe --tags --dirty --match "v*"
0011 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
0012 OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
0013 RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
0014 OUTPUT_STRIP_TRAILING_WHITESPACE)
0015 if(NOT GIT_DESCRIBE_ERROR_CODE)
0016 set(${VERSION} ${GIT_DESCRIBE_VERSION})
0017 endif()
0018 endif()
0019
0020 # Final fallback: Just use a bogus version string that is semantically older
0021 # than anything else and spit out a warning to the developer.
0022 if(NOT DEFINED ${VERSION})
0023 set(${VERSION} v0.0.0-unknown)
0024 message(
0025 WARNING
0026 "Failed to determine VERSION from Git tags. Using default version \"${${VERSION}}\"."
0027 )
0028 endif()
0029 endmacro()