From: Alf Gaida Date: Tue, 17 Feb 2015 22:58:32 +0000 (+0100) Subject: Set GIT_HEAD and GIT_DESCRIBE via environmental variables X-Git-Tag: 0.12-beta1~5^2 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=59695317b057f47ce620e99ac368e3b9b0accf8a Set GIT_HEAD and GIT_DESCRIBE via environmental variables Set GIT_HEAD and GIT_DESCRIBE before run cmake in case no source repo is available - booth values must be extracted at clone/pull time Example: git log -1 | grep commit | sed 's#commit ##' > debian/git_head; \ git describe > debian/git_describe export GIT_HEAD=$(shell [ -f debian/git_head ] && cat debian/git_head) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 70b05c93..d9a397f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -555,11 +555,11 @@ git_describe(GIT_DESCRIBE --long) # If not in a Git repo try to read GIT_HEAD and GIT_DESCRIBE from # enviroment if (NOT GIT_HEAD OR NOT GIT_DESCRIBE) - if (ENV_GIT_HEAD) - set(GIT_HEAD ${ENV_GIT_HEAD}) + if (DEFINED ENV{GIT_HEAD}) + set(GIT_HEAD ${GIT_HEAD}) endif () - if (ENV_GIT_DESCRIBE) - set(GIT_DESCRIBE ${ENV_GIT_DESCRIBE}) + if (DEFINED ENV{GIT_DESCRIBE}) + set(GIT_DESCRIBE ${GIT_DESCRIBE}) endif() endif()