unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Greg Hogan <code@greghogan.com>
To: Hartmut Goebel <h.goebel@crazy-compilers.com>
Cc: 69554@debbugs.gnu.org, "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#69554] [PATCH v2] build-system: cmake: Build tests depending on `#:tests?`.
Date: Wed, 9 Oct 2024 11:04:58 -0400	[thread overview]
Message-ID: <CA+3U0Zkqbc1-a4vSCo1kwgM+F_CO8S0EVi-eowCwWLzb25u9TA@mail.gmail.com> (raw)
In-Reply-To: <7a1b7263-3526-43f9-910b-3148fb9b56ba@crazy-compilers.com>

On Wed, Oct 9, 2024 at 3:32 AM Hartmut Goebel
<h.goebel@crazy-compilers.com> wrote:
>
> Am 08.10.24 um 19:19 schrieb Greg Hogan:
>
> I think we can do this without warnings in the output logs or
> modifications to the project CMakeLists.txt. We can preload
> BUILD_TESTING into the cache:
>
> $ cat cache.txt
> set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
>
> This is a neat trick!
>
> Did you check whether this also overwrites any default in CMakeList.txt? Otherwise we might need to pass `-DBUILD_TESTING=…` on the command line, too.

As I understand it, setting a variable in a "-C" cache file and with a
"-D" command-line argument is equivalent. The only difference is the
requisite precedence, and since we are not specifying "FORCE" for the
"-C" cache file entries any "-D" configure-flags from a Guix package
take precedence.

I also noticed the following in my simple test project, so I am
looking to also move these "-D" arguments into the "-C" cache file in
cmake-build's configure.

--8<---------------cut here---------------start------------->8---
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_INSTALL_LIBDIR
--8<---------------cut here---------------end--------------->8---

This persistent cache is the lowest-level scope [1] so is overwritten
by a "set" command in any CMakeLists.txt. An "option" (for example
BUILD_TESTING in the CTest module) does not affect a normal or cache
variable [2].

[1] https://cmake.org/cmake/help/latest/manual/cmake-language.7.html#cmake-language-variables
[2] https://cmake.org/cmake/help/latest/command/option.html




  reply	other threads:[~2024-10-09 15:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 21:48 [bug#69554] [PATCH] build-system: cmake: Build tests depending on `#:tests?` Hartmut Goebel
2024-03-04 22:58 ` [bug#69554] [PATCH v2] " Hartmut Goebel
2024-07-15  9:40   ` Ludovic Courtès
2024-07-16 15:36     ` Hartmut Goebel
2024-10-07 15:45       ` Greg Hogan
2024-10-08  9:06         ` Hartmut Goebel
2024-10-08 17:19           ` Greg Hogan
2024-10-09  7:32             ` Hartmut Goebel
2024-10-09 15:04               ` Greg Hogan [this message]
2024-10-15  9:17                 ` bug#69554: " Hartmut Goebel

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=CA+3U0Zkqbc1-a4vSCo1kwgM+F_CO8S0EVi-eowCwWLzb25u9TA@mail.gmail.com \
    --to=code@greghogan.com \
    --cc=69554@debbugs.gnu.org \
    --cc=h.goebel@crazy-compilers.com \
    --cc=ludo@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).