1# BAREOS® - Backup Archiving REcovery Open Sourced
2#
3# Copyright (C) 2019-2019 Bareos GmbH & Co. KG
4#
5# This program is Free Software; you can redistribute it and/or modify it under
6# the terms of version three of the GNU Affero General Public License as
7# published by the Free Software Foundation and included in the file LICENSE.
8#
9# This program is distributed in the hope that it will be useful, but WITHOUT
10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
12# details.
13#
14# You should have received a copy of the GNU Affero General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc., 51
16# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18cmake_minimum_required(VERSION 3.0)
19
20if(NOT DEFINED VERSION_STRING)
21  set(CMAKE_MODULE_PATH
22      "${CMAKE_CURRENT_LIST_DIR}/cmake" "${CMAKE_CURRENT_LIST_DIR}/core/cmake"
23      "${CMAKE_CURRENT_LIST_DIR}/webui/cmake"
24  )
25
26  find_package(Git QUIET)
27  include(BareosVersionFromGit)
28
29  include(BareosVersion OPTIONAL RESULT_VARIABLE BareosVersionFile)
30  if(BareosVersionFile STREQUAL "NOTFOUND")
31    if(GIT_DESCRIBE_VERSION)
32      set(VERSION_STRING "${GIT_DESCRIBE_VERSION}")
33    else()
34      message(
35        FATAL_ERROR
36          "VERSION_STRING not set, BareosVersion.cmake not found and no version data from git available.\n"
37          "For more information why this happened and how to fix it, please see "
38          "https://docs.bareos.org/DeveloperGuide/AutomaticVersionGeneration.html#troubleshooting"
39      )
40    endif()
41  endif()
42endif()
43message(STATUS "${VERSION_STRING}")
44