Fix saving lists of arrays with recent versions of numpy
[qpms.git] / cmake / GetGitRevisionDescription.cmake.in
blob116efc4e4eec1f42de65862c65330febac6ad75b
2 # Internal file for GetGitRevisionDescription.cmake
4 # Requires CMake 2.6 or newer (uses the 'function' command)
6 # Original Author:
7 # 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
8 # http://academic.cleardefinition.com
9 # Iowa State University HCI Graduate Program/VRAC
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
18 set(HEAD_HASH)
20 file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
22 string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
23 if(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         else()
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         endif()
35 else()
36         # detached HEAD
37         configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
38 endif()
40 if(NOT HEAD_HASH)
41         file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
42         string(STRIP "${HEAD_HASH}" HEAD_HASH)
43 endif()