ROOT 6.40.02 build failure with CMake 4.4.2


CMake 4.4.2 build failure in ROOT 6.40.02 due to unquoted variable expansion in if()

Where

CMakeLists.txt, lines 607-609

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

What

Building ROOT 6.40.02 with CMake 4.4.2 fails during configuration:

CMake Error at CMakeLists.txt:607 (if):
  if given arguments:

  "(" "var" "MATCHES" "_(LIBRARIES|LIBRARY|INCLUDE|VERSION)" ")" "AND" "("
  "NOT"
  "<ROOT_SRC>/interpreter/llvm-project/clang/include"
  "<ROOT_BUILD>/interpreter/llvm-project/llvm/tools/clang//include"
  "STREQUAL" ""
  ")" "AND" "(" "NOT" "CLANG_INCLUDE_DIRS" "MATCHES" "NOTFOUND" ")"

  Unknown arguments specified

Note: The actual paths have been replaced with <ROOT_SRC> and <ROOT_BUILD> for anonymization.

Workaround

Quoting the variable expansions avoids the configuration error:

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

Question

Is this a known compatibility issue with newer CMake versions?
Is there a recommended patch or workaround for building with CMake 4.4.2?

Environment

ROOT Version: 6.40.02
Platform: openSUSE Tumbleweed
CMake Version: 4.4.2
Compiler: gcc 16.1.1


Welcome to the ROOT Forum!
This issue has been fixed (see [cmake] Quote list-valued cache variable in root-config generation · root-project/root@227e075 · GitHub and [cmake] Quote list-valued cache variable in root-config generation · root-project/root@1cc376e · GitHub) and will be included in the next releases of ROOT

Thanks for the quick feedback and for the fix!