From dee6ebe5d0a9ea5d555852011d219a66d8746b0e Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 23 Aug 2018 18:05:11 +0200 Subject: Fix potential names clash with client projects Nitrokey App was failing to build due to name clash with version.h file. Renamed. Tested CMake, QMake and Meson build. Signed-off-by: Szczepan Zalega --- CMakeLists.txt | 4 ++-- NK_C_API.cc | 2 +- libnitrokey.pro | 8 +++++--- libnitrokey/version-libnk.h | 33 +++++++++++++++++++++++++++++++++ libnitrokey/version.h | 33 --------------------------------- meson.build | 8 ++++---- unittest/Catch | 2 +- version-libnk.cc | 37 +++++++++++++++++++++++++++++++++++++ version-libnk.cc.in | 37 +++++++++++++++++++++++++++++++++++++ version.cc | 37 ------------------------------------- version.cc.in | 37 ------------------------------------- 11 files changed, 120 insertions(+), 118 deletions(-) create mode 100644 libnitrokey/version-libnk.h delete mode 100644 libnitrokey/version.h create mode 100644 version-libnk.cc create mode 100644 version-libnk.cc.in delete mode 100644 version.cc delete mode 100644 version.cc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 32f75a3..32eb62a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ set(SOURCE_FILES NK_C_API.h NK_C_API.cc DeviceCommunicationExceptions.cpp - ${CMAKE_CURRENT_BINARY_DIR}/version.cc + ${CMAKE_CURRENT_BINARY_DIR}/version-libnk.cc ) set(BUILD_SHARED_LIBS ON CACHE BOOL "Build all libraries as shared") @@ -133,7 +133,7 @@ IF((NOT ${ADD_GIT_INFO}) OR (${PROJECT_VERSION_GIT_RETURN_CODE})) SET(PROJECT_VERSION_GIT "unknown") MESSAGE(STATUS "Setting Git library version to: " ${PROJECT_VERSION_GIT} ) ENDIF() -configure_file("version.cc.in" "version.cc" @ONLY) +configure_file("version-libnk.cc.in" "version-libnk.cc" @ONLY) file(GLOB LIB_INCLUDES "libnitrokey/*.h" "NK_C_API.h") diff --git a/NK_C_API.cc b/NK_C_API.cc index 7d0a10e..d529f42 100644 --- a/NK_C_API.cc +++ b/NK_C_API.cc @@ -27,7 +27,7 @@ #include "libnitrokey/LibraryException.h" #include "libnitrokey/cxx_semantics.h" #include "libnitrokey/stick20_commands.h" -#include "version.h" +#include "libnitrokey/version-libnk.h" #ifdef _MSC_VER #ifdef _WIN32 diff --git a/libnitrokey.pro b/libnitrokey.pro index 75ce4a2..b8accba 100644 --- a/libnitrokey.pro +++ b/libnitrokey.pro @@ -13,6 +13,8 @@ QMAKE_TARGET_PRODUCT = libnitrokey QMAKE_TARGET_DESCRIPTION = Communicate with Nitrokey stick devices in a clean and easy manner QMAKE_TARGET_COPYRIGHT = Copyright (c) 2015-2018 Nitrokey UG +message($$PWD) + HEADERS = \ $$PWD/hidapi/hidapi/hidapi.h \ $$PWD/libnitrokey/command.h \ @@ -25,7 +27,7 @@ HEADERS = \ $$PWD/libnitrokey/dissect.h \ $$PWD/libnitrokey/LibraryException.h \ $$PWD/libnitrokey/log.h \ - $$PWD/libnitrokey/version.h \ + $$PWD/libnitrokey/version-libnk.h \ $$PWD/libnitrokey/LongOperationInProgressException.h \ $$PWD/libnitrokey/misc.h \ $$PWD/libnitrokey/NitrokeyManager.h \ @@ -40,7 +42,7 @@ SOURCES = \ $$PWD/device.cc \ $$PWD/DeviceCommunicationExceptions.cpp \ $$PWD/log.cc \ - $$PWD/version.cc \ + $$PWD/version-libnk.cc \ $$PWD/misc.cc \ $$PWD/NitrokeyManager.cc \ $$PWD/NK_C_API.cc @@ -49,7 +51,7 @@ SOURCES = \ tests { SOURCES += \ $$PWD/unittest/catch_main.cpp \ - $$PWD/unittest/test.cc \ + $$PWD/unittest/test1.cc \ $$PWD/unittest/test2.cc \ $$PWD/unittest/test3.cc \ $$PWD/unittest/test_C_API.cpp \ diff --git a/libnitrokey/version-libnk.h b/libnitrokey/version-libnk.h new file mode 100644 index 0000000..6547af0 --- /dev/null +++ b/libnitrokey/version-libnk.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 b/libnitrokey/version.h deleted file mode 100644 index 6547af0..0000000 --- a/libnitrokey/version.h +++ /dev/null @@ -1,33 +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(); - - unsigned int get_minor_library_version(); - - const char* get_library_version(); -} - -#endif diff --git a/meson.build b/meson.build index 600be6d..bbe6830 100644 --- a/meson.build +++ b/meson.build @@ -46,13 +46,13 @@ version_data.set('PROJECT_VERSION_MINOR', version_minor) # We don't want to substitute it by noop version_data.set('PROJECT_VERSION_GIT', '@VCS_TAG@') version_cc_in = configure_file( - input : 'version.cc.in', - output : 'version.cc.in', + input : 'version-libnk.cc.in', + output : 'version-libnk.cc.in', configuration : version_data, ) version_cc = vcs_tag( input : version_cc_in, - output : 'version.cc', + output : 'version-libnk.cc', fallback : 'v@0@'.format(meson.project_version()), ) libnitrokey = library( @@ -90,7 +90,7 @@ install_headers( 'libnitrokey/log.h', 'libnitrokey/LongOperationInProgressException.h', 'libnitrokey/misc.h', - 'libnitrokey/version.h', + 'libnitrokey/version-libnk.h', 'libnitrokey/NitrokeyManager.h', 'libnitrokey/stick10_commands_0.8.h', 'libnitrokey/stick10_commands.h', diff --git a/unittest/Catch b/unittest/Catch index 15cf3ca..62dae59 160000 --- a/unittest/Catch +++ b/unittest/Catch @@ -1 +1 @@ -Subproject commit 15cf3caaceb21172ea42a24e595a2eb58c3ec960 +Subproject commit 62dae592c330ab74cea30c897255ee9518639c3f diff --git a/version-libnk.cc b/version-libnk.cc new file mode 100644 index 0000000..e0de341 --- /dev/null +++ b/version-libnk.cc @@ -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-libnk.h" + +namespace nitrokey { + unsigned int get_major_library_version() { + return 3; + } + + unsigned int get_minor_library_version() { + return 0; + } + + const char* get_library_version() { + return "unknown"; + } +} + diff --git a/version-libnk.cc.in b/version-libnk.cc.in new file mode 100644 index 0000000..a2499ca --- /dev/null +++ b/version-libnk.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-libnk.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@"; + } +} + diff --git a/version.cc b/version.cc deleted file mode 100644 index dfdc802..0000000 --- a/version.cc +++ /dev/null @@ -1,37 +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 - */ - -#include "version.h" - -namespace nitrokey { - unsigned int get_major_library_version() { - return 3; - } - - unsigned int get_minor_library_version() { - return 0; - } - - const char* get_library_version() { - return "unknown"; - } -} - diff --git a/version.cc.in b/version.cc.in deleted file mode 100644 index 0eae647..0000000 --- a/version.cc.in +++ /dev/null @@ -1,37 +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 - */ - -#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