mirror of https://github.com/vitalif/zbackup
Include git version in binary build
parent
9022e1fac4
commit
24303c1309
|
@ -49,6 +49,15 @@ else ( LIBUNWIND_FOUND )
|
|||
set( LIBUNWIND_LIBRARIES )
|
||||
endif( LIBUNWIND_FOUND )
|
||||
|
||||
add_custom_target( invalidate_files ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt" )
|
||||
execute_process( OUTPUT_VARIABLE ZBACKUP_VERSION
|
||||
COMMAND git describe --tags --always
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
if ( ZBACKUP_VERSION )
|
||||
ADD_DEFINITIONS( -DZBACKUP_VERSION="${ZBACKUP_VERSION}" )
|
||||
endif( ZBACKUP_VERSION )
|
||||
|
||||
file( GLOB sourceFiles "*.cc" )
|
||||
add_executable( zbackup ${sourceFiles} ${protoSrcs} ${protoHdrs} )
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
|
||||
// Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE
|
||||
|
||||
#include <string>
|
||||
#ifndef ZBACKUP_VERSION
|
||||
std::string zbackup_version( "1.4" );
|
||||
#else
|
||||
std::string zbackup_version( ZBACKUP_VERSION );
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
// Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and ZBackup contributors, see CONTRIBUTORS
|
||||
// Part of ZBackup. Licensed under GNU GPLv2 or later + OpenSSL, see LICENSE
|
||||
|
||||
#ifndef VERSION_HH_INCLUDED
|
||||
#define VERSION_HH_INCLUDED
|
||||
#include <string>
|
||||
|
||||
extern std::string zbackup_version;
|
||||
|
||||
#endif
|
|
@ -10,6 +10,7 @@
|
|||
#include "backup_collector.hh"
|
||||
#include "config.hh"
|
||||
#include "utils.hh"
|
||||
#include "version.hh"
|
||||
|
||||
using std::vector;
|
||||
using std::bitset;
|
||||
|
@ -443,7 +444,7 @@ invalid_option:
|
|||
if ( args.size() < 1 || printHelp )
|
||||
{
|
||||
fprintf( stderr,
|
||||
"ZBackup, a versatile deduplicating backup tool, version 1.4\n"
|
||||
"ZBackup, a versatile deduplicating backup tool, version %s\n"
|
||||
"Copyright (c) 2012-2014 Konstantin Isakov <ikm@zbackup.org> and\n"
|
||||
"ZBackup contributors\n"
|
||||
"Comes with no warranty. Licensed under GNU GPLv2 or later + OpenSSL.\n"
|
||||
|
@ -475,7 +476,7 @@ invalid_option:
|
|||
" config [show|edit|set] <storage path> - performs configuration\n"
|
||||
" manipulations (default is show)\n"
|
||||
" For export/import storage path must be a valid (initialized) storage\n"
|
||||
"", *argv );
|
||||
"", zbackup_version.c_str(), *argv );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue