2014-12-30 21:37:33 +00:00
|
|
|
execute_process (
|
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-list --tags --max-count=1
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
RESULT_VARIABLE EXITCODE1
|
|
|
|
OUTPUT_VARIABLE TAGHASH
|
2017-03-05 18:28:29 +00:00
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
ERROR_QUIET)
|
2014-12-30 21:37:33 +00:00
|
|
|
|
|
|
|
execute_process (
|
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
|
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
|
|
RESULT_VARIABLE EXITCODE2
|
|
|
|
OUTPUT_VARIABLE COMMITHASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
2017-03-05 18:28:29 +00:00
|
|
|
string (COMPARE EQUAL "${EXITCODE1}:${EXITCODE2}" "0:0" FULL_SUCCESS)
|
|
|
|
string (COMPARE EQUAL "${EXITCODE2}" "0" COMMIT_SUCCESS)
|
|
|
|
if (FULL_SUCCESS)
|
2014-12-30 21:37:33 +00:00
|
|
|
set(OPENMW_VERSION_COMMITHASH "${COMMITHASH}")
|
|
|
|
set(OPENMW_VERSION_TAGHASH "${TAGHASH}")
|
|
|
|
message(STATUS "OpenMW version ${OPENMW_VERSION}")
|
2017-03-05 18:28:29 +00:00
|
|
|
elseif (COMMIT_SUCCESS)
|
|
|
|
set(OPENMW_VERSION_COMMITHASH "${COMMITHASH}")
|
|
|
|
message(STATUS "OpenMW version ${OPENMW_VERSION}")
|
|
|
|
else ()
|
2014-12-30 21:37:33 +00:00
|
|
|
message(WARNING "Failed to get valid version information from Git")
|
2017-03-05 18:28:29 +00:00
|
|
|
endif ()
|
2014-12-30 21:37:33 +00:00
|
|
|
|
2017-10-12 01:45:50 +00:00
|
|
|
include(${MACROSFILE})
|
2017-10-11 20:58:55 +00:00
|
|
|
|
|
|
|
configure_resource_file(${VERSION_IN_FILE} ${VERSION_FILE_PATH_BASE} ${VERSION_FILE_PATH_RELATIVE})
|