Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cmake script to write version files
- Loading branch information
Showing
4 changed files
with
46 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ debian/*.log | |
# etags and cscope db | ||
tags | ||
cscope.out | ||
|
||
# generated version files | ||
*/cmake/BareosVersion.cmake |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# BAREOS® - Backup Archiving REcovery Open Sourced | ||
# | ||
# Copyright (C) 2019-2019 Bareos GmbH & Co. KG | ||
# | ||
# This program is Free Software; you can redistribute it and/or modify it under | ||
# the terms of version three of the GNU Affero General Public License as | ||
# published by the Free Software Foundation and included in the file LICENSE. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more | ||
# details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., 51 | ||
# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" | ||
"${CMAKE_CURRENT_LIST_DIR}/core/cmake" | ||
"${CMAKE_CURRENT_LIST_DIR}/webui/cmake") | ||
|
||
find_package(Git) | ||
include(BareosVersionFromGit) | ||
|
||
include(BareosVersion OPTIONAL RESULT_VARIABLE BareosVersionFile) | ||
if(BareosVersionFile STREQUAL "NOTFOUND") | ||
if(GIT_DESCRIBE_VERSION) | ||
set(VERSION_STRING "${GIT_DESCRIBE_VERSION}") | ||
else() | ||
message(FATAL_ERROR "No version information from git available.") | ||
endif() | ||
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") | ||
|
||
foreach(subdir "core" "webui") | ||
set(version_file_name "${CMAKE_CURRENT_LIST_DIR}/${subdir}/cmake/BareosVersion.cmake") | ||
message(STATUS "Writing ${version_file_name}") | ||
file(WRITE ${version_file_name} "${version_file_contents}") | ||
endforeach() |