CMake Configure Error on Windows

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:

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


See ROOT 6.40.02 build failure with CMake 4.4.2