From 6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Fri, 25 May 2018 09:51:34 +0200 Subject: Add getters for the library version CMake generates version.h from version.h.in and sets the major and minor version as specified in CMakeLists.txt and the current git version as returned by `git describe --always`. These values are also added to the C API as NK_get{_major,_minor,}_library_version. --- libnitrokey/version.h.in | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 libnitrokey/version.h.in (limited to 'libnitrokey') diff --git a/libnitrokey/version.h.in b/libnitrokey/version.h.in new file mode 100644 index 0000000..20c3179 --- /dev/null +++ b/libnitrokey/version.h.in @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018 Nitrokey UG + * + * This file is part of libnitrokey. + * + * libnitrokey is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * libnitrokey 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 General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnitrokey. If not, see . + * + * SPDX-License-Identifier: LGPL-3.0 + */ + +#ifndef LIBNITROKEY_VERSION_H +#define LIBNITROKEY_VERSION_H + +namespace nitrokey { +unsigned int get_major_library_version() { + return @PROJECT_VERSION_MAJOR@; +} + +unsigned int get_minor_library_version() { + return @PROJECT_VERSION_MINOR@; +} + +const char* get_library_version() { + return "@PROJECT_VERSION_GIT@"; +} +} + +#endif -- cgit v1.2.1