From 35ba2261ddeac3881dc7d4f14b737947a19a4b9b Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 19 Jun 2018 14:56:33 +0200 Subject: Move implementation from header back to compilation unit Signed-off-by: Szczepan Zalega --- CMakeLists.txt | 9 +++++---- libnitrokey/version.h | 33 +++++++++++++++++++++++++++++++++ libnitrokey/version.h.in | 39 --------------------------------------- version.cc.in | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 43 deletions(-) create mode 100644 libnitrokey/version.h delete mode 100644 libnitrokey/version.h.in create mode 100644 version.cc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 11e3f3c..06ab448 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,6 @@ IF (NOT CMAKE_BUILD_TYPE) ENDIF() MESSAGE("${PROJECT_NAME}: Build type: ${CMAKE_BUILD_TYPE}") -include_directories(${CMAKE_CURRENT_BINARY_DIR}/libnitrokey) include_directories(hidapi) include_directories(libnitrokey) set(SOURCE_FILES @@ -67,7 +66,9 @@ set(SOURCE_FILES NitrokeyManager.cc NK_C_API.h NK_C_API.cc - DeviceCommunicationExceptions.cpp) + DeviceCommunicationExceptions.cpp + ${CMAKE_CURRENT_BINARY_DIR}/version.cc + ) set(BUILD_SHARED_LIBS ON CACHE BOOL "Build all libraries as shared") add_library(nitrokey ${SOURCE_FILES}) @@ -118,10 +119,10 @@ ENDIF() # generate version.h exec_program("git" ${CMAKE_CURRENT_SOURCE_DIR} ARGS "describe --always" OUTPUT_VARIABLE PROJECT_VERSION_GIT) -configure_file("libnitrokey/version.h.in" "libnitrokey/version.h" @ONLY) +configure_file("version.cc.in" "version.cc" @ONLY) -file(GLOB LIB_INCLUDES "libnitrokey/*.h" "NK_C_API.h" "${CMAKE_CURRENT_BINARY_DIR}/libnitrokey/version.h") +file(GLOB LIB_INCLUDES "libnitrokey/*.h" "NK_C_API.h") install (FILES ${LIB_INCLUDES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}) install (TARGETS nitrokey DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/libnitrokey/version.h b/libnitrokey/version.h new file mode 100644 index 0000000..6547af0 --- /dev/null +++ b/libnitrokey/version.h @@ -0,0 +1,33 @@ +/* + * 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(); + + unsigned int get_minor_library_version(); + + const char* get_library_version(); +} + +#endif diff --git a/libnitrokey/version.h.in b/libnitrokey/version.h.in deleted file mode 100644 index 20c3179..0000000 --- a/libnitrokey/version.h.in +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 diff --git a/version.cc.in b/version.cc.in new file mode 100644 index 0000000..0eae647 --- /dev/null +++ b/version.cc.in @@ -0,0 +1,37 @@ +/* + * 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 + */ + +#include "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@"; + } +} + -- cgit v1.2.1