GNU bug report logs -
#69554
[PATCH] build-system: cmake: Build tests depending on `#:tests?`.
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Tue, 15 Oct 2024 11:17:00 +0200
with message-id <8ddae1f4-da16-42b2-9281-6f71c9b3fed9 <at> crazy-compilers.com>
and subject line Re: [bug#69554] [PATCH v2] build-system: cmake: Build tests depending on `#:tests?`.
has caused the debbugs.gnu.org bug report #69554,
regarding [PATCH] build-system: cmake: Build tests depending on `#:tests?`.
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
69554: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=69554
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
* guix/build/cmake-build-system.scm (configure): New paremeter `#:tests?`.
Add cmake option "-DBUILD_TESTING=" with value "ON" or "OFF" depending
on build-system argument `#:tests?`.
* * doc/guix.texi (Inspecting Services)[cmake-build-system]: Document it.
---
doc/guix.texi | 10 ++++++++++
guix/build/cmake-build-system.scm | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 87fe9f803c..409d076d12 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9617,6 +9617,16 @@ parameter specifies in abstract terms the flags passed to the compiler;
it defaults to @code{"RelWithDebInfo"} (short for ``release mode with
debugging information''), which roughly means that code is compiled with
@code{-O2 -g}, as is the case for Autoconf-based packages by default.
+
+Depending on the @code{#:tests?} parameter, the configure-flag
+@code{BUILD_TESTING} is set to @code{ON} resp. @code{OFF}.
+@code{BUILD_TESTING} is a
+@url{https://cmake.org/cmake/help/v3.28/module/CTest.html, standard
+defined by CMake} to enable or disable building tests. This aims to
+save build time if tests are not run anyway, while trying to ensure
+tests are build if they should be run. Anyhow, the CMakeLists.txt needs
+to implement handling this flag.
+
@end defvar
@defvar composer-build-system
diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
index d1ff5071be..71e8ca8a83 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -33,7 +33,7 @@ (define-module (guix build cmake-build-system)
;; Code:
(define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
- build-type target
+ (tests? #t) build-type target
#:allow-other-keys)
"Configure the given package."
(let* ((out (assoc-ref outputs "out"))
@@ -62,6 +62,11 @@ (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib")
;; enable verbose output from builds
"-DCMAKE_VERBOSE_MAKEFILE=ON"
+ ;; ask for (not) building tests depending on #:tests?
+ ;; (CMakeLists.txt may or may not implement this check)
+ ,@(if tests?
+ '("-DBUILD_TESTING=OFF") ; not run anyway
+ '("-DBUILD_TESTING=ON")) ; overwrite any default option
;; Cross-build
,@(if target
base-commit: 3da49b1472919a62df1fe399638f23a246aa325d
--
2.41.0
[Message part 3 (message/rfc822, inline)]
Hi Greg,
I did some testing with different combinations and with defining the
option in CMakeList.txt. Everything works as I would expect. So please
go for it.
I'm closing this patch in favor of your #70031.
--
Regards
Hartmut Goebel
| Hartmut Goebel | h.goebel <at> crazy-compilers.com |
| www.crazy-compilers.com | compilers which you thought are impossible |
This bug report was last modified 277 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.