From f5d69052e12cbea0146744ce084e7427df505c62 Mon Sep 17 00:00:00 2001 From: blueboy Date: Fri, 18 Feb 2011 05:19:46 +0300 Subject: [PATCH] [11184] Allow build mangos without git repo * Avoid cmake call fail if git binary found but - no git repository in current dir - git repository exist but no tags in repository * Output commit hash instead most recent tag name. Signed-off-by: VladimirMangos --- CMakeLists.txt | 7 ++++++- src/shared/revision_nr.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b66a8c00f..3b674ab4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,10 +217,15 @@ add_custom_target(uninstall # Find core revision if(GIT_EXECUTABLE) execute_process( - COMMAND ${GIT_EXECUTABLE} describe + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_REVISION + RESULT_VARIABLE GIT_RESULT + ERROR_QUIET ) + if(GIT_RESULT) + set(GIT_REVISION "Git repository not found") + endif() else() set(GIT_REVISION "Git not found") endif() diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0ff14ef39..9c3e2ff51 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11183" + #define REVISION_NR "11184" #endif // __REVISION_NR_H__