From 775ef51d04f3281b1b2ea857d7862470069aaf6a Mon Sep 17 00:00:00 2001 From: Tobias Ulvgard Date: Fri, 2 Oct 2015 17:05:58 +0200 Subject: [PATCH 1/2] CMake check for git on the system --- cmake/GetGitVersion.cmake | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cmake/GetGitVersion.cmake b/cmake/GetGitVersion.cmake index e017fa3051..c49e308951 100644 --- a/cmake/GetGitVersion.cmake +++ b/cmake/GetGitVersion.cmake @@ -10,7 +10,8 @@ # include(GetGitVersion) # get_git_version(GIT_VERSION) # -# Requires CMake 2.6+ +# Requires CMake 2.8.11+ +find_package(Git) if(__get_git_version) return() @@ -18,17 +19,22 @@ endif() set(__get_git_version INCLUDED) function(get_git_version var) - execute_process(COMMAND git describe --match "v[0-9]*.[0-9]*.[0-9]*" --abbrev=8 - RESULT_VARIABLE status - OUTPUT_VARIABLE GIT_VERSION - ERROR_QUIET) - if(${status}) - set(GIT_VERSION "v0.0.0") + if(GIT_EXECUTABLE) + execute_process(COMMAND git describe --match "v[0-9]*.[0-9]*.[0-9]*" --abbrev=8 + RESULT_VARIABLE status + OUTPUT_VARIABLE GIT_VERSION + ERROR_QUIET) + if(${status}) + set(GIT_VERSION "v0.0.0") + else() + string(STRIP ${GIT_VERSION} GIT_VERSION) + string(REGEX REPLACE "-[0-9]+-g" "-" GIT_VERSION ${GIT_VERSION}) + endif() else() - string(STRIP ${GIT_VERSION} GIT_VERSION) - string(REGEX REPLACE "-[0-9]+-g" "-" GIT_VERSION ${GIT_VERSION}) + set(GIT_VERSION "v0.0.0") endif() + # Work out if the repository is dirty execute_process(COMMAND git update-index -q --refresh OUTPUT_QUIET From c06da04bcf28237a803fae1445e7589a4d5f6cd7 Mon Sep 17 00:00:00 2001 From: Tobias Ulvgard Date: Wed, 7 Oct 2015 17:28:00 +0200 Subject: [PATCH 2/2] Adds Dirac Research and me as Author and Contributor --- AUTHORS | 1 + CONTRIBUTORS | 1 + 2 files changed, 2 insertions(+) diff --git a/AUTHORS b/AUTHORS index 3d9d1df408..cccde3d795 100644 --- a/AUTHORS +++ b/AUTHORS @@ -24,3 +24,4 @@ Oleksandr Sochka Paul Redmond Shuo Chen Yusuke Suzuki +Dirac Research diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 42d713bca5..ea0f555f52 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -40,3 +40,4 @@ Paul Redmond Pierre Phaneuf Shuo Chen Yusuke Suzuki +Tobias Ulvgård