Disabling present for Linux-arm64 on Linux-arm64 target machine.

Hello All,

I am trying to disable Linux-arm64 preset (defined in our CMakePresets.json) on linux x64 machine. To do that we tried below

        {
            "name": "Linux-arm64",
            "inherits": [
                "PRESETOS:Linux-ARCH:arm64",
                "PRESETKERNEL:Linux-ARCH:arm64",
                "OSLinux",
                "ARCHarm64",
                "Default"
            ],
            "vendor": {
                "microsoft.com/VisualStudioSettings/CMake/1.0": {
                    "hostOS": "Linux"
                },
           },
            "condition": {
                "type": "equals",
                "lhs": "${CMAKE_SYSTEM_PROCESSOR}",
                "rhs": "x86_64"

            }
        },

This works fine when I select generate cmake cache generation on Linux machine. It hides Linux-arm64 presets which is what we want.

Since my this CMakePresets.json also have presets (Windowx-x64, Windows-arm64,etc) on my windows builds. When I run below command on command line it gives me below error

D:\TW\Workspace>cmake --preset Windows-x64
CMake Error: Could not read presets from D:/TW/Workspace: Invalid macro expansion

I also tried using Visual Studio CMake Folder option. We are using Visual Studio IDE with cmake integration. When I tried to generate cache for Windows target system I get below error.

Severity Code Description Project File Line Suppression State
Error (active) Failed to evaluate macro ‘${CMAKE_SYSTEM_PROCESSOR}’. D:\TW\Workspace\CMakePresets.json 1

If I try same preset for Linux targets it works fine.

AM I doing anything wrong ?

${CMAKE_SYSTEM_PROCESSOR} is not a valid macro expansion. It is a CMake cache variable, but you cannot read those in a presets file. The behavior under Windows is expected. The behavior under Linux is not, it should also be giving you an error there too.