2014-12-30 21:37:33 +00:00
|
|
|
execute_process (
|
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-list --tags --max-count=1
|
2023-08-31 18:55:28 +00:00
|
|
|
WORKING_DIRECTORY ${OpenMW_SOURCE_DIR}
|
2014-12-30 21:37:33 +00:00
|
|
|
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
|
2023-08-31 18:55:28 +00:00
|
|
|
WORKING_DIRECTORY ${OpenMW_SOURCE_DIR}
|
2014-12-30 21:37:33 +00:00
|
|
|
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
|
|
|
|
2023-08-31 18:55:28 +00:00
|
|
|
configure_resource_file(${VERSION_RESOURCE_FILE_IN} ${OpenMW_BINARY_DIR} ${VERSION_RESOURCE_FILE_RELATIVE})
|
|
|
|
configure_file("${OpenMW_SOURCE_DIR}/${VERSION_CPP_FILE}.in" "${OpenMW_BINARY_DIR}/${VERSION_CPP_FILE}")
|