# Sets version information variables and provides CMake functions for
# generating files based on them
#
-# This script provides the following basic version variables that need to be
-# maintained manually:
+# The following variables are derived from variables initialized by
+# https://cmake.org/cmake/help/latest/command/project.html#command:project
# GMX_VERSION_MAJOR Major version number.
# GMX_VERSION_PATCH Patch version number.
# Should always be defined: zero for, e.g., 2016.
+#
+# This script provides the following basic version variables that need to be
+# maintained manually:
# GMX_VERSION_SUFFIX String suffix to add to numeric version string.
# "-dev" is automatically added when not building from a source package,
# and does not need to be kept here. This mechanism is not quite enough
# The scripts gmxGenerateVersionInfo.cmake and gmxConfigureVersionInfo.cmake
# are used internally by this machinery, as well as VersionInfo.cmake.cmakein.
+#####################################################################
+# Derived version info.
+# Ref https://cmake.org/cmake/help/latest/command/project.html#command:project
+set(GMX_VERSION_MAJOR ${Gromacs_VERSION_MAJOR})
+set(GMX_VERSION_PATCH ${Gromacs_VERSION_MINOR})
+
#####################################################################
# Manually maintained version info
-# The GROMACS convention is that these are the version number of the next
-# release that is going to be made from this branch.
-set(GMX_VERSION_MAJOR 2022)
-set(GMX_VERSION_PATCH 0)
-# The suffix, on the other hand, is used mainly for betas and release
+# The suffix is used mainly for betas and release
# candidates, where it signifies the most recent such release from
# this branch; it will be empty before the first such release, as well
# as after the final release is out.
option(GMX_BUILD_TARBALL "Build tarball without -dev version suffix" OFF)
mark_as_advanced(GMX_BUILD_TARBALL)
-# If run with cmake -P, the -dev suffix is managed elsewhere.
if (NOT SOURCE_IS_SOURCE_DISTRIBUTION AND
- NOT GMX_BUILD_TARBALL AND
- NOT CMAKE_SCRIPT_MODE_FILE)
+ NOT GMX_BUILD_TARBALL)
set(GMX_VERSION_STRING "${GMX_VERSION_STRING}-dev")
endif()
"${GMX_VERSION_MAJOR}*10000 + ${GMX_VERSION_PATCH}")
set(GMX_API_VERSION ${GMX_VERSION_NUMERIC})
-# If run with cmake -P from GitLab scripts, print out necessary version info
-# as JSON.
-if (CMAKE_SCRIPT_MODE_FILE)
- message("{ \"version\": \"${GMX_VERSION_STRING}\", \"regressiontest-md5sum\": \"${REGRESSIONTEST_MD5SUM}\" }")
- return()
-endif()
-
# Set those values only in release versions, after getting the identifiers
# from Zenodo for the manual and source code
# Has to be done by hand before every final release
# - These are again custom commands that depend on the output from
# step 1, so they get regenerated only when the static version info
# changes.
+#
+# Note that VersionInfo-partial.cmake is also used to transfer version
+# information between GitLab CI jobs for release and documentation builds.
# Check if we have all necessary python modules available
if (Python3_Interpreter_FOUND)