vscode-cmake-tools: Preferred generators are ignored

Fields listed below are ignored. The only way I found to specify a generator is via cmake.generator in settings.json.

Field preferredGenerator in cmake-kits.json is ignored. Field cmake.preferredGenerators is settings.json is ignored.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 25 (7 by maintainers)

Most upvoted comments

I have the same problem trying to select Unix Makefiles over Ninja, I tried everything (together or apart, nothing worked):

{
    "cmake.preferredGenerators":[],
    "cmake.preferredGenerators":[
        "Unix Makefiles",
        "Ninja",
    ],
    "cmake.generator": "Unix Makefiles",
    "cmake.configureArgs": ["-G", "Unix Makefiles"],
}

In the end the only solution that worked for me was to select No active kit.

I had trouble getting the extension to select the Visual Studio generator I’d specified for my kit.

I discovered that there are default values for cmake.preferredGenerators (“Ninja”, “Unix Makefile”) and if either of these is present in the system, it will select them over the one you’ve specified for the kit. I guess the term preferred should have made it obvious to me, but I didn’t notice this setting and also assumed that specifying a generator for a kit would override other “fallback” settings.

In the end I overrode the default value of cmake.preferredGenerators with an empty user setting, and configured the generator explicitly for each kit.

FYI - I was running into the same problem where cmake.generator, cmake.preferredGenerators etc. were being ignored. I found that using Ctrl-Shift-P and executing Developer: Reload Window caused the settings changes to take effect.