[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 <vladimir@getmangos.com>
This commit is contained in:
blueboy 2011-02-18 05:19:46 +03:00 committed by VladimirMangos
parent d597ffe10e
commit f5d69052e1
2 changed files with 7 additions and 2 deletions

View file

@ -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()

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11183"
#define REVISION_NR "11184"
#endif // __REVISION_NR_H__