# ROOT 6.40.02 build failure with CMake 4.4.2

**URL:** <https://root-forum.cern.ch/t/root-6-40-02-build-failure-with-cmake-4-4-2/64968>\
**Category:** Newbie\
**Created:** [August 7, 2026, 1:23pm UTC](https://root-forum.cern.ch/t/root-6-40-02-build-failure-with-cmake-4-4-2/64968 "2026-08-07T13:23:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daimmig](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@daimmig](https://root-forum.cern.ch/u/daimmig)\
**Post date:** [August 7, 2026, 1:23pm UTC](https://root-forum.cern.ch/t/root-6-40-02-build-failure-with-cmake-4-4-2/64968/1 "2026-08-07T13:23:48Z")

</div>

* * *

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

## Where

`CMakeLists.txt`, lines 607-609

```cmake
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:

```plaintext
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:

```cmake
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

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [August 7, 2026, 2:14pm UTC](https://root-forum.cern.ch/t/root-6-40-02-build-failure-with-cmake-4-4-2/64968/2 "2026-08-07T14:14:23Z")

</div>

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](https://github.com/root-project/root/commit/227e0753f5c5ef9070b892d70848192fc16d06d5) and [[cmake] Quote list-valued cache variable in root-config generation · root-project/root@1cc376e · GitHub](https://github.com/root-project/root/commit/1cc376e3bf06ea54880fc4c14f0d3de6af82fdd3)) and will be included in the next releases of ROOT

---

<div class="post-metadata">

**Author:** ![daimmig](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/dc4da7/32.png) [@daimmig](https://root-forum.cern.ch/u/daimmig)\
**Post date:** [August 7, 2026, 3:00pm UTC](https://root-forum.cern.ch/t/root-6-40-02-build-failure-with-cmake-4-4-2/64968/3 "2026-08-07T15:00:25Z")

</div>

Thanks for the quick feedback and for the fix!
