Page MenuHome GnuPG

No OneTemporary

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8dd98293..2d82c805 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,79 +1,83 @@
# CMakeLists.txt for GpgME++
# Copyright 2025 g10 Code GmbH
# Software engineering by Carl Schwan <carl.schwan@gnupg.com>
# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
#
# This file is part of GPGME++.
#
# GPGME++ 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 2.1 of the
# License, or (at your option) any later version.
#
# GPGME++ 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 Lesser General
# Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <https://gnu.org/licenses/>.
# SPDX-License-Identifier: LGPL-2.1-or-later
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(FULL_VERSION "2.0.0")
string(REGEX MATCH "^[0-9]+.[0-9]+.[0-9]+" cmake_compat_version ${FULL_VERSION})
project(gpgmepp VERSION ${cmake_compat_version})
set(VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(VERSION_MICRO ${PROJECT_VERSION_PATCH})
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++)
# (Interfaces removed: AGE=0)
set(LIBGPGMEPP_LT_CURRENT "28")
set(LIBGPGMEPP_LT_AGE "22")
set(LIBGPGMEPP_LT_REVISION "0")
math(EXPR LIBGPGMEPP_SOVERSION "${LIBGPGMEPP_LT_CURRENT} - ${LIBGPGMEPP_LT_AGE}")
set(GPG_ERROR_REQUIRED_VERSION "1.47")
set(GPGME_REQUIRED_VERSION "1.24.2")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
include(G10CMakeSettings)
include(G10CompilerSettings)
include(G10GetFullVersion)
include(FeatureSummary)
include(GNUInstallDirs)
find_package(LibGpgError ${GPG_ERROR_REQUIRED_VERSION})
set_package_properties(LibGpgError PROPERTIES TYPE REQUIRED)
find_package(Gpgme ${GPGME_REQUIRED_VERSION})
set_package_properties(Gpgme PROPERTIES TYPE REQUIRED)
g10_get_full_version()
# create the VERSION file
find_package(Git QUIET)
if (GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
# get the current commit ID
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE commit_id
)
string(STRIP "${commit_id}" commit_id) # strip trailing whitespace
file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${G10_FULL_VERSION}\n${commit_id}\n")
elseif(EXISTS "${CMAKE_SOURCE_DIR}/VERSION")
configure_file("${CMAKE_SOURCE_DIR}/VERSION" "VERSION" COPYONLY)
else()
file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${G10_FULL_VERSION}\nunknown\n")
endif()
add_subdirectory(src)
+if(BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
+
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/cmake/modules/G10CMakeSettings.cmake b/cmake/modules/G10CMakeSettings.cmake
index 4bf9e9cb..862569c9 100644
--- a/cmake/modules/G10CMakeSettings.cmake
+++ b/cmake/modules/G10CMakeSettings.cmake
@@ -1,61 +1,70 @@
# Common CMake settings for g10 Code; based on KDECMakeSettings.cmake
#
# Copyright 2014 Alex Merry <alex.merry@kde.org>
# Copyright 2013 Aleix Pol <aleixpol@kde.org>
# Copyright 2012-2013 Stephen Kelly <steveire@gmail.com>
# Copyright 2007 Matthias Kretz <kretz@kde.org>
# Copyright 2006-2007 Laurent Montel <montel@kde.org>
# Copyright 2006-2013 Alex Neundorf <neundorf@kde.org>
# Copyright 2025 g10 Code GmbH
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# SPDX-License-Identifier: BSD-3-Clause
+################ Testing setup ####################################
+
+option(BUILD_TESTING "Build the testing tree" ON)
+if(BUILD_TESTING)
+ enable_testing()
+endif()
+
+
+
################ Build-related settings ###########################
# Always include srcdir and builddir in include path
# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} in about every subdir
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are preferred over the already installed ones
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
# Add the src and build dir to the BUILD_INTERFACE include directories
# of all targets. Similar to CMAKE_INCLUDE_CURRENT_DIR, but transitive.
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
# When a shared library changes, but its includes do not, don't relink
# all dependencies. It is not needed.
set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
# Add the SOVERSION target property to the filename of generated DLL filenames
if (WIN32 AND NOT MSVC)
# Official variable for enabling versioned DLL filenames; since cmake 3.27
set(CMAKE_DLL_NAME_WITH_SOVERSION ON)
# Undocumented variable which has the same effect (used internally for Cygwin)
set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION ON)
endif()
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 00000000..a7f193b0
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,34 @@
+# CMakeLists.txt for GpgME++ tests
+# Copyright 2025 g10 Code GmbH
+# Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+#
+# This file is part of GPGME++.
+#
+# GPGME++ 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 2.1 of the
+# License, or (at your option) any later version.
+#
+# GPGME++ 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 Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, see <https://gnu.org/licenses/>.
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+macro(_g10_add_testprogram _source)
+ get_filename_component(_name ${_source} NAME_WE)
+ add_executable(${_name} ${_source})
+ target_link_libraries(${_name} Gpgmepp)
+ set_target_properties(${_target} PROPERTIES
+ WIN32_EXECUTABLE FALSE # don't build as GUI app on Windows
+ MACOSX_BUNDLE FALSE # don't build as GUI app on macOS
+ )
+endmacro()
+
+_g10_add_testprogram(run-getkey.cpp)
+_g10_add_testprogram(run-keylist.cpp)
+_g10_add_testprogram(run-verify.cpp)
+_g10_add_testprogram(run-wkdlookup.cpp)
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index 61b91633..00000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-# Makefile.am - Makefile for GPGME Cpp tests.
-# Copyright (C) 2018 Intevation GmbH
-#
-# This file is part of GPGME.
-#
-# GPGME 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 2.1 of the
-# License, or (at your option) any later version.
-#
-# GPGME 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 Lesser General
-# Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, see <https://www.gnu.org/licenses/>.
-
-## Process this file with automake to produce Makefile.in
-
-AM_LDFLAGS = -no-install
-
-LDADD = ../src/libgpgmepp.la \
- @GPGME_LIBS@ @GPG_ERROR_LIBS@ \
- @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
-
-AM_CPPFLAGS = -I$(top_srcdir)/src @GPGME_CFLAGS@ \
- @GPG_ERROR_CFLAGS@ @GPG_ERROR_CFLAGS@ \
- -DBUILDING_GPGMEPP
-
-run_getkey_SOURCES = run-getkey.cpp
-run_keylist_SOURCES = run-keylist.cpp
-run_verify_SOURCES = run-verify.cpp
-if !HAVE_W32_SYSTEM
-run_wkdlookup_SOURCES = run-wkdlookup.cpp
-endif
-
-if HAVE_W32_SYSTEM
-programs_unix =
-else
-programs_unix = run-wkdlookup
-endif
-
-noinst_PROGRAMS = run-getkey run-keylist run-verify $(programs_unix)
diff --git a/tests/README b/tests/README
index ac74ab00..ffb96fe3 100644
--- a/tests/README
+++ b/tests/README
@@ -1,4 +1,4 @@
Tests for the C++ bindings.
Most autotests for the C++ bindings use the QTest framework
-and live in lang/qt/tests.
+and live in gpgmeqt.

File Metadata

Mime Type
text/x-diff
Expires
Fri, Dec 5, 9:34 AM (1 d, 14 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
38/dd/c34e67ef0c7a2ba10d992e792230

Event Timeline