[ismrmrd] 07/16: fixing CMakeLists.txt to allow build if `.git` dir is missing

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:02:30 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to annotated tag v1.2.0
in repository ismrmrd.

commit 05c903c3b3605c1ff874a87a4554be7cd2b0e712
Author: Joseph Naegele <joseph.naegele at gmail.com>
Date:   Mon Dec 8 11:37:36 2014 -0500

    fixing CMakeLists.txt to allow build if `.git` dir is missing
---
 CMakeLists.txt | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 72d2117..384f4ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,8 +94,14 @@ set(ISMRMRD_SOVERSION ${ISMRMRD_VERSION_MAJOR}.${ISMRMRD_VERSION_MINOR})
 # Generate the version.h header file
 find_package(Git)
 if (GIT_FOUND)
-  execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE ISMRMRD_GIT_SHA1)
-  string(STRIP ${ISMRMRD_GIT_SHA1} ISMRMRD_GIT_SHA1)
+    execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY
+            ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE ISMRMRD_GIT_SHA1 ERROR_VARIABLE ISMRMRD_GIT_STDERR)
+    string(STRIP "${ISMRMRD_GIT_SHA1}" ISMRMRD_GIT_SHA1)
+    string(LENGTH "${ISMRMRD_GIT_SHA1}" ISMRMRD_GIT_SHA1_LEN)
+    if (${ISMRMRD_GIT_SHA1_LEN} LESS 40)
+        message(WARNING "Could not determine SHA-1 hash: ${ISMRMRD_GIT_STDERR}")
+        set(ISMRMRD_GIT_SHA1 "NA")
+    endif (${ISMRMRD_GIT_SHA1_LEN} LESS 40)
 else()
   set(ISMRMRD_GIT_SHA1 "NA")
 endif()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git



More information about the debian-science-commits mailing list