Create list variables in CMakePresets.json

Is there a way to create list variables in CMakePresets.json? For instance, a list of preprocessor macros to then be passed to target_compile_definitions?

In CMake syntax, I’d do something like

# which is equivalent to...
list(MY_DEFINES_2 MACRO1;MACRO_2=value1;MACRO_3=value2)

# and either may be used like
add_executable(main main.cpp)
# which causes something like g++ -DMACRO_1 -DMACRO_2=value1 -DMACRO_3=value2 main.cpp`

Now, I have a project that requires at least two dozen macros, and I’d like to define these as early as possible—in CMakePresets.json as part of an inheritable, hidden configure preset, under cacheVariables. Intuitively, I would think of using JSON arrays:

configurePresets: [
    "name": "defines",
    "hidden": true,
    "cacheVariables": {
      "MY_DEFINES": [
    "name": "windows-debug",
    "inherits": [

I foresee these could be used for command-line flags (CMAKE_CXX_FLAGS), macros, and other house-keeping lists to keep as clean a set of CMakeLists files as possible. Is this legitmate? I know other projects like cmake-init simply dump a whitespace-separated list of strings (actually just one string) into these variables, and it makes for extremely long lines and rather unpleasant reading.

I also welcome feedback on best practices. Is this the best idea, setting macros and flags in presets? Should I be defining these variables in a MyMacros.cmake file instead, to be include()d in my various CMakeLists.txts?


EDIT: I notice this issue is still open. It’s still not clear how I can currently define list variables—do I just set "MY_DEFINES": "MACRO1;MACRO_2=value1;MACRO_3=value2" in the presets file?