diff options
author | Andreas Rogge <andreas.rogge@bareos.com> | 2019-10-25 15:41:17 +0300 |
---|---|---|
committer | Andreas Rogge <andreas.rogge@bareos.com> | 2019-11-13 12:46:34 +0300 |
commit | 5e6c094aa8982df2eb279bb57f03b6b96762cb77 (patch) | |
tree | 50ae9569b4e9baf589523d236c9d8419fbfcb98a /write_version_files.cmake | |
parent | aaf0ea1db88f6a7133bb1dcc5cf52f1a2c634e4b (diff) |
Allow forcing the version with -DVERSION_STRING=
previously the scripts get_version.cmake and write_version_files.cmake
did not honor a VERSION_STRING that was set on the commandline. Now
you can use cmake -DVERSION_STRING -P <script>.cmake to force the
version to be used.
While this is not very useful in case of get_version.cmake it will be
used to write the correct release version numbers into the release
tarballs.
Diffstat (limited to 'write_version_files.cmake')
-rw-r--r-- | write_version_files.cmake | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/write_version_files.cmake b/write_version_files.cmake index 0becb098a..f37f967ed 100644 --- a/write_version_files.cmake +++ b/write_version_files.cmake @@ -24,18 +24,19 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" find_package(Git) include(BareosVersionFromGit) -include(BareosVersion OPTIONAL RESULT_VARIABLE BareosVersionFile) -if(BareosVersionFile STREQUAL "NOTFOUND") - if(GIT_DESCRIBE_VERSION) +if(GIT_DESCRIBE_VERSION) + if(NOT DEFINED VERSION_STRING) set(VERSION_STRING "${GIT_DESCRIBE_VERSION}") - else() - message(FATAL_ERROR "No version information from git available.") endif() + set(VERSION_TIMESTAMP "${GIT_COMMIT_TIMESTAMP}") +else() + message(FATAL_ERROR "No version information from git available.") endif() set(version_file_header "# autogenerated by write_version_files.cmake") -set(version_file_contents "${version_file_header}\nset(VERSION_STRING \"${GIT_DESCRIBE_VERSION}\")\nset(VERSION_TIMESTAMP \"${GIT_COMMIT_TIMESTAMP}\")\n") +set(version_file_contents "${version_file_header}\nset(VERSION_STRING \"${VERSION_STRING}\")\nset(VERSION_TIMESTAMP \"${VERSION_TIMESTAMP}\")\n") +message(STATUS "Configuring source tree for version ${VERSION_STRING} with timestamp ${VERSION_TIMESTAMP}") foreach(subdir "core" "webui") set(version_file_name "${CMAKE_CURRENT_LIST_DIR}/${subdir}/cmake/BareosVersion.cmake") message(STATUS "Writing ${version_file_name}") |