2015-08-06 15:01:11 -06:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --long
|
2015-06-24 17:32:45 -06:00
|
|
|
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE DFHACK_GIT_DESCRIPTION)
|
2015-08-06 15:30:51 -06:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
|
|
|
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
|
|
|
OUTPUT_VARIABLE DFHACK_GIT_COMMIT)
|
2015-10-17 13:35:40 -06:00
|
|
|
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags --exact-match
|
|
|
|
WORKING_DIRECTORY "${dfhack_SOURCE_DIR}"
|
|
|
|
RESULT_VARIABLE DFHACK_GIT_TAGGED_RESULT
|
|
|
|
OUTPUT_QUIET ERROR_QUIET)
|
2015-06-24 17:32:45 -06:00
|
|
|
string(STRIP ${DFHACK_GIT_DESCRIPTION} DFHACK_GIT_DESCRIPTION)
|
|
|
|
file(WRITE ${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h
|
2015-08-06 15:30:51 -06:00
|
|
|
"#define DFHACK_GIT_DESCRIPTION \"${DFHACK_GIT_DESCRIPTION}\"\n")
|
|
|
|
string(STRIP ${DFHACK_GIT_COMMIT} DFHACK_GIT_COMMIT)
|
|
|
|
file(APPEND ${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h
|
2015-10-17 13:35:40 -06:00
|
|
|
"#define DFHACK_GIT_COMMIT \"${DFHACK_GIT_COMMIT}\"\n")
|
|
|
|
if(${DFHACK_GIT_TAGGED_RESULT} EQUAL 0)
|
|
|
|
file(APPEND ${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h
|
|
|
|
"#define DFHACK_GIT_TAGGED\n")
|
|
|
|
endif()
|
2015-06-24 17:32:45 -06:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
|
|
${dfhack_SOURCE_DIR}/library/include/git-describe.tmp.h
|
|
|
|
${dfhack_SOURCE_DIR}/library/include/git-describe.h)
|