build: Allow setting version string at build.

When retrieving the source from git, the version string is not known
in advance, and git is invoked to compute it.  In some environments
such as Guix, there is no git metadata kept during the build as this
would introduce non-determinism; it is thus necessary to be able to
manually set the version (which is displayed when the game launches).

* CMakeLists.txt (VERSION_LONG): Make it a cache variable, so that
users can override it using e.g., -DVERSION:STRING=2.4.0.
This commit is contained in:
Maxim Cournoyer 2025-02-01 21:27:52 +09:00
parent c5b0a2b38a
commit 90accd9d4c
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -114,7 +114,7 @@ if(NOT result EQUAL 0)
set(VERSION "undefined-version")
endif()
set(VERSION_LONG ${VERSION})
set(VERSION_LONG ${VERSION} CACHE STRING "The version string displayed")
# CMAKE_PROJECT_VERSION_TWEAK is used by NSIS packagers
# its what comes after the '-' sign (if anything)