summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2023-06-08 12:03:37 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2023-06-08 13:35:20 +0200
commit7de1c17593069f8b35adf886eed91be6a9fc490d (patch)
treef4cf6264808fb0900418df432a570fc8aea6bcbd /dev-libs
parentdev-libs/libqtolm: new package, add 3.0.1 (diff)
downloadgentoo-7de1c17593069f8b35adf886eed91be6a9fc490d.tar.gz
gentoo-7de1c17593069f8b35adf886eed91be6a9fc490d.tar.bz2
gentoo-7de1c17593069f8b35adf886eed91be6a9fc490d.zip
dev-libs/libqtolm: Wire up testing (by improving upstream's cmake)
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'dev-libs')
-rw-r--r--dev-libs/libqtolm/files/libqtolm-3.0.1-cmake.patch64
-rw-r--r--dev-libs/libqtolm/libqtolm-3.0.1.ebuild12
2 files changed, 75 insertions, 1 deletions
diff --git a/dev-libs/libqtolm/files/libqtolm-3.0.1-cmake.patch b/dev-libs/libqtolm/files/libqtolm-3.0.1-cmake.patch
new file mode 100644
index 000000000000..fc3d6cb3d581
--- /dev/null
+++ b/dev-libs/libqtolm/files/libqtolm-3.0.1-cmake.patch
@@ -0,0 +1,64 @@
+From b1ab7541d30764273e0353921b654f779937c910 Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm@gentoo.org>
+Date: Thu, 8 Jun 2023 12:00:12 +0200
+Subject: [PATCH] Use CTest module and standard BUILD_TESTING switch
+
+Enables downstream package testing integration.
+
+See also:
+https://cmake.org/cmake/help/latest/command/enable_testing.html
+https://cmake.org/cmake/help/latest/module/CTest.html#module:CTest
+
+Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
+---
+ CMakeLists.txt | 5 ++++-
+ tests/CMakeLists.txt | 10 ++--------
+ 2 files changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index eb0b244..afd4f82 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.1)
+ set(API_VERSION "3.0")
+ project(qtolm VERSION "${API_VERSION}.1" LANGUAGES CXX)
+
++include(CTest)
+ include(CheckCXXCompilerFlag)
+ if (WIN32)
+ if (NOT CMAKE_INSTALL_LIBDIR)
+@@ -97,7 +98,9 @@ target_link_libraries(QtOlm Olm::Olm Qt5::Core)
+
+ configure_file(QtOlm.pc.in ${CMAKE_CURRENT_BINARY_DIR}/QtOlm.pc @ONLY NEWLINE_STYLE UNIX)
+
+-add_subdirectory(tests)
++if(BUILD_TESTING)
++ add_subdirectory(tests)
++endif()
+
+ # Installation
+
+diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
+index 091efcd..5cb2b55 100644
+--- a/tests/CMakeLists.txt
++++ b/tests/CMakeLists.txt
+@@ -6,14 +6,8 @@ set(SOURCE_FILES
+ main.cpp
+ )
+
+-set(INCLUDE_DIRS
+- .
+-)
+-
+-set(ALL_FILES ${HEADERS_FILES} ${SOURCE_FILES})
+-
+-add_executable(${PROJECT_NAME} ${ALL_FILES})
++add_executable(${PROJECT_NAME} ${SOURCE_FILES})
+
+ target_link_libraries(${PROJECT_NAME} Qt5::Core QtOlm)
+
+-target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIRS})
++add_test(main ${PROJECT_NAME})
+--
+2.41.0
+
diff --git a/dev-libs/libqtolm/libqtolm-3.0.1.ebuild b/dev-libs/libqtolm/libqtolm-3.0.1.ebuild
index 718069ac57ef..442fc4df70de 100644
--- a/dev-libs/libqtolm/libqtolm-3.0.1.ebuild
+++ b/dev-libs/libqtolm/libqtolm-3.0.1.ebuild
@@ -13,10 +13,20 @@ S="${WORKDIR}/${PN}-v${PV}"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64"
-IUSE=""
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+PATCHES=( "${FILESDIR}/${P}-cmake.patch" ) # TODO: upstream
DEPEND="
dev-libs/olm
dev-qt/qtcore:5
"
RDEPEND="${DEPEND}"
+
+src_configure() {
+ local mycmakeargs=(
+ -DBUILD_TESTING=$(usex test)
+ )
+ cmake_src_configure
+}