public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/kde:master commit in: kde-frameworks/extra-cmake-modules/, kde-frameworks/extra-cmake-modules/files/
Date: Tue,  8 Aug 2017 07:17:47 +0000 (UTC)	[thread overview]
Message-ID: <1502176651.06d50c76fcc5d796c53c6ac4b1c0857f47eea3ef.asturm@gentoo> (raw)

commit:     06d50c76fcc5d796c53c6ac4b1c0857f47eea3ef
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  8 07:17:31 2017 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Aug  8 07:17:31 2017 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=06d50c76

kde-frameworks/extra-cmake-modules: Backport fix to ECMAddTests.cmake

Respecting BUILD_TESTING will enable us to drop a lot of eclass magic.

Package-Manager: Portage-2.3.6, Repoman-2.3.1

 .../extra-cmake-modules-5.37.0.ebuild              |  2 +
 .../extra-cmake-modules-5.37.0-ecmaddtest.patch    | 74 ++++++++++++++++++++++
 2 files changed, 76 insertions(+)

diff --git a/kde-frameworks/extra-cmake-modules/extra-cmake-modules-5.37.0.ebuild b/kde-frameworks/extra-cmake-modules/extra-cmake-modules-5.37.0.ebuild
index a1079a5899..231e84818f 100644
--- a/kde-frameworks/extra-cmake-modules/extra-cmake-modules-5.37.0.ebuild
+++ b/kde-frameworks/extra-cmake-modules/extra-cmake-modules-5.37.0.ebuild
@@ -31,6 +31,8 @@ RDEPEND="
 	app-arch/libarchive[bzip2]
 "
 
+PATCHES=( "${FILESDIR}/${P}-ecmaddtest.patch" )
+
 python_check_deps() {
 	has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
 }

diff --git a/kde-frameworks/extra-cmake-modules/files/extra-cmake-modules-5.37.0-ecmaddtest.patch b/kde-frameworks/extra-cmake-modules/files/extra-cmake-modules-5.37.0-ecmaddtest.patch
new file mode 100644
index 0000000000..fe86754188
--- /dev/null
+++ b/kde-frameworks/extra-cmake-modules/files/extra-cmake-modules-5.37.0-ecmaddtest.patch
@@ -0,0 +1,74 @@
+From b99d2d2c5dedcaba9745dddc1dd7b8d4811babf1 Mon Sep 17 00:00:00 2001
+From: Kevin Funk <kfunk@kde.org>
+Date: Mon, 7 Aug 2017 15:50:25 +0200
+Subject: RFC: Make ECMAddTests respect BUILD_TESTING
+
+Summary:
+Use-case: Make building unit tests optional, by just following the CMake
+BUILD_TESTING option.
+
+The usual approach to conditionally build tests is to do:
+```
+if (BUILD_TESTING)
+    add_executable(TestOne TestOne.cpp)
+    target_link_libraries(TestOne my_library)
+endif()
+```
+
+or:
+
+```
+if (BUILD_TESTING)
+    add_subdirectory(tests)
+endif()
+```
+
+This patch just turns all calls to ecm_add_test(...) into no-ops if
+BUILD_TESTING=OFF.
+
+See:
+  https://cmake.org/cmake/help/v3.6/module/CTest.html
+
+Reviewers: vkrause
+
+Reviewed By: vkrause
+
+Subscribers: kossebau, vkrause, elvisangelaccio, asturmlechner, apol, #frameworks, #build_system
+
+Tags: #frameworks, #build_system
+
+Differential Revision: https://phabricator.kde.org/D7187
+---
+ modules/ECMAddTests.cmake | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake
+index 9667388..c77a7aa 100644
+--- a/modules/ECMAddTests.cmake
++++ b/modules/ECMAddTests.cmake
+@@ -49,6 +49,12 @@
+ # be given; this will be used for both the target and test names (and, as with
+ # ecm_add_tests(), the NAME_PREFIX argument will be prepended to the test name).
+ #
++# If BUILD_TESTING is set to OFF, ecm_add_test will turn into a no-op and thus
++# will not add any test-related targets
++#
++# BUILD_TESTING is created as a cache variable by the CTest module and by the
++# :kde-module:`KDECMakeSettings` module.
++#
+ #
+ # Since pre-1.0.0.
+ 
+@@ -84,6 +90,10 @@ include(ECMMarkAsTest)
+ include(ECMMarkNonGuiExecutable)
+ 
+ function(ecm_add_test)
++  if(NOT BUILD_TESTING)
++      return() # turn this function into a no-op
++  endif()
++
+   set(options GUI)
+   # TARGET_NAME_VAR and TEST_NAME_VAR are undocumented args used by
+   # ecm_add_tests
+-- 
+cgit v0.11.2


             reply	other threads:[~2017-08-08  7:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08  7:17 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-01-07 19:15 [gentoo-commits] proj/kde:master commit in: kde-frameworks/extra-cmake-modules/, kde-frameworks/extra-cmake-modules/files/ Andreas Sturmlechner
2019-12-09 14:50 Andreas Sturmlechner
2020-07-12 22:55 Andreas Sturmlechner
2020-08-30 19:02 Andreas Sturmlechner
2021-10-05 15:49 Andreas Sturmlechner
2021-12-29 19:16 Andreas Sturmlechner
2022-03-29 10:51 Andreas Sturmlechner
2023-11-19 20:29 Andreas Sturmlechner
2024-10-12 12:01 Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502176651.06d50c76fcc5d796c53c6ac4b1c0857f47eea3ef.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox