Codefix: [Win32] Use correct range for version in rc file

This commit is contained in:
glx22 2024-06-26 18:22:56 +02:00 committed by Loïc Guilloux
parent 5ed2fcfb53
commit b52f778f20
2 changed files with 9 additions and 6 deletions

View File

@ -57,7 +57,6 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
)
string(REGEX REPLACE "([0-9]+)-([0-9]+)-([0-9]+).*" "\\1\\2\\3" COMMITDATE "${COMMITDATE}")
set(REV_ISODATE "${COMMITDATE}")
string(SUBSTRING "${REV_ISODATE}" 0 4 REV_YEAR)
# Get the branch
execute_process(COMMAND ${GIT_EXECUTABLE} symbolic-ref -q HEAD
@ -114,7 +113,6 @@ elseif(EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
list(GET OTTDREV 3 REV_HASH)
list(GET OTTDREV 4 REV_ISTAG)
list(GET OTTDREV 5 REV_ISSTABLETAG)
list(GET OTTDREV 6 REV_YEAR)
else()
message(WARNING "No version detected; this build will NOT be network compatible")
set(REV_VERSION "norev0000")
@ -123,14 +121,19 @@ else()
set(REV_HASH "unknown")
set(REV_ISTAG 0)
set(REV_ISSTABLETAG 0)
set(REV_YEAR "1970")
endif()
# Extract REV_YEAR and REV_DATE from REV_ISODATE
string(SUBSTRING "${REV_ISODATE}" 0 4 REV_YEAR)
string(SUBSTRING "${REV_ISODATE}" 4 4 REV_DATE)
# Drop leading 0 in REV_DATE if any
string(REGEX REPLACE "^0?([0-9]+)" "\\1" REV_DATE "${REV_DATE}")
message(STATUS "Version string: ${REV_VERSION}")
if(GENERATE_OTTDREV)
message(STATUS "Generating .ottdrev")
file(WRITE ${CMAKE_SOURCE_DIR}/.ottdrev "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\t${REV_YEAR}\n")
file(WRITE ${CMAKE_SOURCE_DIR}/.ottdrev "${REV_VERSION}\t${REV_ISODATE}\t${REV_MODIFIED}\t${REV_HASH}\t${REV_ISTAG}\t${REV_ISSTABLETAG}\n")
else()
message(STATUS "Generating rev.cpp")
configure_file("${CMAKE_SOURCE_DIR}/src/rev.cpp.in"

View File

@ -76,8 +76,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION ${REV_MAJOR},${REV_MINOR},0,${REV_ISODATE}
PRODUCTVERSION ${REV_MAJOR},${REV_MINOR},0,${REV_ISODATE}
FILEVERSION ${REV_MAJOR},${REV_MINOR},${REV_YEAR},${REV_DATE}
PRODUCTVERSION ${REV_MAJOR},${REV_MINOR},${REV_YEAR},${REV_DATE}
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L