Skip to content

CMakePrests.json toolset requires the VS version instead of the toolset version #1965

@barcharcraz

Description

@barcharcraz

I'm using the following CMakePresets.json file

{
    "version": 2,
    "configurePresets": [
        {
            "name": "base",
            "hidden": true,
            "generator": "Ninja",
            "binaryDir": "${sourceDir}/out/build/${presetName}",
            "cacheVariables": {
                "CMAKE_CXX_COMPILER": "cl.exe",
                "CMAKE_C_COMPILER": "cl.exe",
                "CMAKE_BUILD_TYPE": "Debug"
            },
            "toolset": {
                "value": "x64",
                "strategy": "external"
            }
        },
        {
            "name": "x86",
            "inherits": "base",
            "architecture": {
                "value": "x86"
            }
        },
        {
            "name": "x64",
            "inherits": "base",
            "architecture": {
                "value": "x64"
            }
        },
        {
            "name": "ARM",
            "inherits": "base",
            "architecture": {
                "value": "arm"
            }
        },
        {
            "name": "ARM64",
            "inherits": "base",
            "architecture": {
                "value": "arm64"
            }
        }
    ],
    "buildPresets": [
        {
            "name": "default",
            "configurePreset": "base",
            "verbose": true
        }
    ]
}

Whenever a new preset is selected cmake tools prints:

[preset] Configure preset x86: No toolset architecture specified for cl.exe, using x86 by default
[preset] Configure preset x86: No toolset version specified for cl.exe, using latest by default

and the x64 compiler is not selected, moving the preset selection to inside each derived preset does not work either.

Interestingly the architecture setting does seem to work even though "strategy" is not "external" (this is fine by me).

Also, in this example cmake tools is not selecting the latest toolset, I have vs 2022 installed and it's never selected, while the latest version of vs 2019 16.11 preview is selected for x86 and x64, and an older version of vs 2019 int preview is selected for arm and arm64, this could be sticky settings, but cmake tools does find all my VS installs when scanning for compilers.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions