GNU bug report logs - #69554
[PATCH] build-system: cmake: Build tests depending on `#:tests?`.

Previous Next

Package: guix-patches;

Reported by: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Date: Mon, 4 Mar 2024 21:50:01 UTC

Severity: normal

Tags: patch

Done: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 69554 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: Greg Hogan <code <at> greghogan.com>
Cc: 69554 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#69554] [PATCH v2] build-system: cmake: Build tests depending
 on `#:tests?`.
Date: Tue, 8 Oct 2024 11:06:34 +0200
[Message part 1 (text/plain, inline)]
Am 07.10.24 um 17:45 schrieb Greg Hogan:
> Could we detect with `cmake -L` [1] that the package has a
> BUILD_TESTING option and only then pass this flag?

Running `cmake -L` would run the configure phase. Thus we would need to 
configure twice: first to learn whether BUILD_TESTING is defined and 
then a second time to change it. We might be able to optimize this: if 
BUILD_TESTING is already set to the value we want, we can skip the 
second run. While we can hope that the second run will be cheap, if 
might not if things change depending on the values.

IMHO this is too much effort just to suppress a warning.

Anyhow, there is a much simpler solution, according to 
<https://stackoverflow.com/questions/36451368/> we could just add a line 
to the CMakeList.txt file.

$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(lalala)
set(__guix_suppress_BUILD_TESTING_warning__ "${BUILD_TESTING}")
$ cmake -DBUILD_TESTING=OFF .
…
-- Generating done (0.0s)
-- Build files have been written to: /tmp/xxx

Voila, no warning.

WDYT?

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          |h.goebel <at> crazy-compilers.com                |
|www.crazy-compilers.com  | compilers which you thought are impossible |
[Message part 2 (text/html, inline)]

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.