# CMake Configure Error on Windows

**URL:** <https://root-forum.cern.ch/t/cmake-configure-error-on-windows/64985>\
**Category:** ROOT\
**Tags:** cmake\
**Created:** [September 2, 2026, 9:31am UTC](https://root-forum.cern.ch/t/cmake-configure-error-on-windows/64985 "2026-09-02T09:31:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phoenixAspies](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/phoenixaspies/32/25456_2.png) [@phoenixAspies](https://root-forum.cern.ch/u/phoenixAspies)\
**Post date:** [September 2, 2026, 9:31am UTC](https://root-forum.cern.ch/t/cmake-configure-error-on-windows/64985/1 "2026-09-02T09:31:03Z")

</div>

Hi ROOT developers,

I encountered a configure-time CMake error when building ROOT 6.36.12 from source on Windows, and I believe it is a _bug_ in the main CMakeLists.txt.

**Environment**  
·OS: Windows 11  
·Compiler: Visual Studio 2026  
·CMake: 4.4.3  
·ROOT version: 6.36.12  
·CMake generator: Visual Studio 18 2026 (Multi-Config)

The error looks like:

`CMake Error at CMakeLists.txt:309 (if): if given arguments: "(" "var" "MATCHES" "_(LIBRARIES|LIBRARY|INCLUDE|VERSION)" ")" "AND" "(" "NOT" "Debug" "Release" "MinSizeRel" "RelWithDebInfo" "STREQUAL" "" ")" "AND" "(" "NOT" "CMAKE_CONFIGURATION_TYPES" "MATCHES" "NOTFOUND" ")" Unknown arguments specified`

In CMakeLists.txt around line 309, inside the loop that populates **ROOT\_CONFIGARGS:**

```bash
get_cmake_property(variables CACHE_VARIABLES)
foreach(var ${variables})
  if((var MATCHES "_(LIBRARIES|LIBRARY|INCLUDE|VERSION)") AND
     (NOT ${${var}} STREQUAL "") AND # <-- missing quotes
     (NOT ${var} MATCHES "NOTFOUND")) # <-- missing quotes

```

When using a Visual Studio Multi-Config generator, `CMAKE_CONFIGURATION_TYPES` (and potentially `CMAKE_BUILD_TYPE`) is a CMake list (`Debug;Release;MinSizeRel;RelWithDebInfo`). Because `${${var}}` and `${var}` are unquoted, the list expands into multiple separate arguments, causing the `if()` command to receive an invalid number of arguments.

Adding quotes around the variable expansions resolves the issue:

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

* * *

_ROOT Version:_ 6.36.12  
_Platform:_ Windows 11  
_Compiler:_ Visual Studio 2026 & CMake 4.4.3

* * *

---

<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:** [September 2, 2026, 10:09am UTC](https://root-forum.cern.ch/t/cmake-configure-error-on-windows/64985/2 "2026-09-02T10:09:23Z")

</div>

See [ROOT 6.40.02 build failure with CMake 4.4.2](https://root-forum.cern.ch/t/root-6-40-02-build-failure-with-cmake-4-4-2/64968)

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [September 16, 2026, 10:12am UTC](https://root-forum.cern.ch/t/cmake-configure-error-on-windows/64985/3 "2026-09-16T10:12:27Z")

</div>

Closed on September 16, 2026, 10:12am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
