diff options
author | Robin Krahl <me@robin-krahl.de> | 2018-05-25 09:51:34 +0200 |
---|---|---|
committer | Robin Krahl <me@robin-krahl.de> | 2018-05-25 10:07:10 +0200 |
commit | 6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478 (patch) | |
tree | 639d4586c6909e79391853a4ebd1908f5ff2eca2 /libnitrokey/version.h.in | |
parent | aee920b21d3951d2166ff73a533461e1bdd16e7f (diff) | |
download | libnitrokey-6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478.tar.gz libnitrokey-6e3ae3175b34679cf1e84fc6dc5b9ebe6a9c0478.tar.bz2 |
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.
Diffstat (limited to 'libnitrokey/version.h.in')
-rw-r--r-- | libnitrokey/version.h.in | 39 |
1 files changed, 39 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>. + * + * 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 |