Atlas - GetGitRevisionDescription.cmake.in
Home / ext / SDL / cmake Lines: 1 | Size: 1562 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)][FILE BEGIN]1# 2# Internal file for GetGitRevisionDescription.cmake 3# 4# Requires CMake 2.6 or newer (uses the 'function' command) 5# 6# Original Author: 7# 2009-2010 Ryan Pavlik <[email protected]> <[email protected]> 8# http://academic.cleardefinition.com 9# Iowa State University HCI Graduate Program/VRAC 10# 11# Copyright 2009-2012, Iowa State University 12# Copyright 2011-2015, Contributors 13# Distributed under the Boost Software License, Version 1.0. 14# (See accompanying file LICENSE_1_0.txt or copy at 15# http://www.boost.org/LICENSE_1_0.txt) 16# SPDX-License-Identifier: BSL-1.0 17 18set(HEAD_HASH) 19 20file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 21 22string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 23if(HEAD_CONTENTS MATCHES "ref") 24 # named branch 25 string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 26 if(EXISTS "@GIT_DIR@/${HEAD_REF}") 27 configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 28 elseif(EXISTS "@GIT_DIR@/packed-refs") 29 configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 30 file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 31 if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 32 set(HEAD_HASH "${CMAKE_MATCH_1}") 33 endif() 34 elseif(EXISTS "@GIT_DIR@/reftable/tables.list") 35 configure_file("@GIT_DIR@/reftable/tables.list" "@GIT_DATA@/reftable-tables.list" COPYONLY) 36 endif() 37else() 38 # detached HEAD 39 configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 40endif() 41 42if(NOT HEAD_HASH AND EXISTS "@GIT_DATA@/head-ref") 43 file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 44 string(STRIP "${HEAD_HASH}" HEAD_HASH) 45endif() 46[FILE END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.