Skip to content

[v636][cmake] Quote list-valued cache variable in root-config generation - #23027

Merged
pcanal merged 1 commit into
root-project:v6-36-00-patchesfrom
pcanal:v6-36-22790
Aug 5, 2026
Merged

[v636][cmake] Quote list-valued cache variable in root-config generation#23027
pcanal merged 1 commit into
root-project:v6-36-00-patchesfrom
pcanal:v6-36-22790

Conversation

@pcanal

@pcanal pcanal commented Aug 5, 2026

Copy link
Copy Markdown
Member

The loop that builds the root-config --config argument list guards each cache variable with

if((var MATCHES "_(LIBRARIES|LIBRARY|INCLUDE|VERSION)") AND
   (NOT ${${var}} STREQUAL "") AND
   (NOT ${var} MATCHES "NOTFOUND"))

When the variable holds a list (e.g.
CLING_LIBRARIES=clingInterpreter;clingMetaProcessor;clingUtils) the unquoted ${${var}} expands to several tokens, so the parenthesised sub-expression (NOT a b c STREQUAL "") is malformed. CMake silently accepted this until 4.4, which now propagates errors from parenthesised if() sub-expressions (Kitware/CMake@240481490c, kitware/cmake#26424) and fails configuration with "Unknown arguments specified".

Quote the expansion so the value is compared as a single string. Besides fixing configuration with CMake >= 4.4, this restores the intended behaviour: list-valued variables were previously dropped from root-config --config (the malformed guard evaluated to false) and are now included.

Backport of #22790

The loop that builds the `root-config --config` argument list guards each
cache variable with

    if((var MATCHES "_(LIBRARIES|LIBRARY|INCLUDE|VERSION)") AND
       (NOT ${${var}} STREQUAL "") AND
       (NOT ${var} MATCHES "NOTFOUND"))

When the variable holds a list (e.g.
CLING_LIBRARIES=clingInterpreter;clingMetaProcessor;clingUtils) the
unquoted ${${var}} expands to several tokens, so the parenthesised
sub-expression `(NOT a b c STREQUAL "")` is malformed. CMake silently
accepted this until 4.4, which now propagates errors from parenthesised
if() sub-expressions (Kitware/CMake@240481490c, kitware/cmake#26424) and
fails configuration with "Unknown arguments specified".

Quote the expansion so the value is compared as a single string. Besides
fixing configuration with CMake >= 4.4, this restores the intended
behaviour: list-valued variables were previously dropped from
`root-config --config` (the malformed guard evaluated to false) and are
now included.

Signed-off-by: Chris Burr <christopher.burr@cern.ch>
@pcanal pcanal self-assigned this Aug 5, 2026
@pcanal
pcanal requested a review from bellenot as a code owner August 5, 2026 13:32
@pcanal

pcanal commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

/backport to 6.32

@pcanal
pcanal requested a lite review from Copilot and removed request for bellenot August 5, 2026 13:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates ROOT’s top-level CMake configuration logic to remain compatible with CMake ≥ 4.4 when evaluating cache variables whose values may be CMake lists (semicolon-separated).

Changes:

  • Quote the dereferenced cache-variable value in the if() guard used while assembling root-config --config arguments, preventing malformed if() expressions when the value is list-valued.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Test Results

    16 files      16 suites   2d 7h 37m 57s ⏱️
 2 753 tests  2 753 ✅ 0 💤 0 ❌
42 554 runs  42 554 ✅ 0 💤 0 ❌

Results for commit 504af81.

@pcanal
pcanal merged commit f8771bf into root-project:v6-36-00-patches Aug 5, 2026
20 checks passed
@pcanal
pcanal deleted the v6-36-22790 branch August 5, 2026 16:27
@pcanal

pcanal commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

/backport to 6.32

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23027 to branch 6.32 requested by pcanal

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.32: #23031

@pcanal

pcanal commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

/backport to 6.28

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23027 to branch 6.28 requested by pcanal

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.28: #23032

@pcanal

pcanal commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

/backport to 6.30

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #23027 to branch 6.30 requested by pcanal

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.30: #23033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants