git: 5308f4b52976 - main - net-im/toxext: Add test target

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 21 Mar 2022 17:51:18 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5308f4b529765e2e145ea2e7152679e3a75607a2

commit 5308f4b529765e2e145ea2e7152679e3a75607a2
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-03-21 17:50:38 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-03-21 17:51:15 +0000

    net-im/toxext: Add test target
    
    Only build tests when tests are run.
---
 net-im/toxext/Makefile                   |  3 ++-
 net-im/toxext/files/patch-CMakeLists.txt | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/net-im/toxext/Makefile b/net-im/toxext/Makefile
index a3198e55469d..6a77c0d415d9 100644
--- a/net-im/toxext/Makefile
+++ b/net-im/toxext/Makefile
@@ -14,10 +14,11 @@ LIB_DEPENDS=	libopus.so:audio/opus \
 		libtoxcore.so:net-im/tox \
 		libvpx.so:multimedia/libvpx
 
-USES=		cmake localbase:ldflags pkgconfig
+USES=		cmake:testing localbase:ldflags pkgconfig
 USE_GITHUB=	yes
 
 CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_TESTING_ON=	BUILD_TESTS
 
 CFLAGS+=	-fPIC # see https://github.com/toxext/toxext/issues/7
 
diff --git a/net-im/toxext/files/patch-CMakeLists.txt b/net-im/toxext/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..eb0ea86f3616
--- /dev/null
+++ b/net-im/toxext/files/patch-CMakeLists.txt
@@ -0,0 +1,14 @@
+--- CMakeLists.txt.orig	2022-03-21 17:46:44 UTC
++++ CMakeLists.txt
+@@ -15,7 +15,9 @@ endfunction()
+ add_subdirectory(src)
+ add_subdirectory(mock)
+ 
+-enable_testing()
+-add_subdirectory(test)
++if (BUILD_TESTS)
++	enable_testing()
++	add_subdirectory(test)
++endif()
+ 
+ install(EXPORT ToxExtConfig DESTINATION lib/cmake/ToxExt NAMESPACE ToxExt::)