summaryrefslogtreecommitdiff
path: root/cmake/scripts
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2020-06-05 21:43:22 +0200
committerglx22 <glx22@users.noreply.github.com>2020-06-05 22:32:07 +0200
commit877d196ef5c28321d94c9dfd978b7cae35672533 (patch)
tree3a8a8920b0993c0df6219b595f321b9588680ff2 /cmake/scripts
parent945508b8549505482fd186cc185a93f3fb3e3726 (diff)
downloadopenttd-877d196ef5c28321d94c9dfd978b7cae35672533.tar.xz
Fix: Incorrect REV_YEAR, and parsing of .ottdrev
Diffstat (limited to 'cmake/scripts')
-rw-r--r--cmake/scripts/FindVersion.cmake3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmake/scripts/FindVersion.cmake b/cmake/scripts/FindVersion.cmake
index 00afa15ca..d48664fc8 100644
--- a/cmake/scripts/FindVersion.cmake
+++ b/cmake/scripts/FindVersion.cmake
@@ -49,7 +49,7 @@ 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 1 4 REV_YEAR)
+ string(SUBSTRING "${REV_ISODATE}" 0 4 REV_YEAR)
# Get the branch
execute_process(COMMAND ${GIT_EXECUTABLE} symbolic-ref -q HEAD
@@ -98,6 +98,7 @@ if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
set(ENV{LC_ALL} "${SAVED_LC_ALL}")
elseif (EXISTS "${CMAKE_SOURCE_DIR}/.ottdrev")
file(READ "${CMAKE_SOURCE_DIR}/.ottdrev" OTTDREV)
+ string(REPLACE "\n" "" OTTDREV "${OTTDREV}")
string(REPLACE "\t" ";" OTTDREV "${OTTDREV}")
list(GET OTTDREV 0 REV_VERSION)
list(GET OTTDREV 1 REV_ISODATE)