Warning, /acts/cmake/GetGitRevisionDescription.cmake.in is written in an unsupported language. File is not indexed.
0001 #
0002 # Internal file for GetGitRevisionDescription.cmake
0003 #
0004 # Requires CMake 2.6 or newer (uses the 'function' command)
0005 #
0006 # Original Author:
0007 # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
0008 # http://academic.cleardefinition.com
0009 # Iowa State University HCI Graduate Program/VRAC
0010 #
0011 # Copyright Iowa State University 2009-2010.
0012 # Distributed under the Boost Software License, Version 1.0.
0013 # (See accompanying file LICENSE_1_0.txt or copy at
0014 # http://www.boost.org/LICENSE_1_0.txt)
0015
0016 set(HEAD_HASH)
0017
0018 file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
0019
0020 string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
0021 if(HEAD_CONTENTS MATCHES "ref")
0022 # named branch
0023 string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
0024 if(EXISTS "@GIT_DIR@/${HEAD_REF}")
0025 configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
0026 else()
0027 configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
0028 file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
0029 if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
0030 set(HEAD_HASH "${CMAKE_MATCH_1}")
0031 endif()
0032 endif()
0033 else()
0034 # detached HEAD
0035 configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
0036 endif()
0037
0038 if(NOT HEAD_HASH)
0039 file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
0040 string(STRIP "${HEAD_HASH}" HEAD_HASH)
0041 endif()