question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSCode cannot find CMake generator

See original GitHub issue

Brief Issue Summary

I update VSCode 1.40.0. And, CMake cannot find CMake generator. In previous VSCode version, I can use CMake/Build.

CMake Tools Log

Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json, your Kit configuration or PATH variable. Error: No usable generator found.

Platform and Versions

  • Operating System: Windows 10
  • CMake Version: 3.14.0
  • VSCode Version: 1.40.0
  • CMake Tools Extension Version: 1.2.1
  • Compiler/Toolchain: mingw-w64 gcc, g++

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

29reactions
Foadsfcommented, Mar 14, 2020

I had MSYS2-MinGW installed and the way I solved it:

  1. I assume you have the below MSYS2 packages installed with pacman -S:
  • mingw64/mingw-w64-x86_64-gcc
  • mingw64/mingw-w64-x86_64-make
  • mingw64/mingw-w64-x86_64-cmake
  1. You need to open the settings.json by <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>P</kbd> and serach-select Preference: Open settings (JSON)
  2. and then add the lines below:
    "cmake.cmakePath": "C:\\msys64\\mingw64\\bin\\cmake.exe",
    "cmake.mingwSearchDirs": [
      "C:\\msys64\\mingw64\\bin"
   ],
   "cmake.generator": "MinGW Makefiles"
  1. and then open the CMake: Edit User-Local CMake Kits which opens the cmake-tools-kits.json file where you need to have:
  {
    "name": "Mingw64 GCC 9.3.0",
    "compilers": {
      "C": "C:\\msys64\\mingw64\\bin\\gcc.exe",
      "CXX": "C:\\msys64\\mingw64\\bin\\g++.exe"
    },
    "preferredGenerator": {
      "name": "MinGW Makefiles",
      "platform": "x64"
    },
    "environmentVariables": {
      "PATH": "C:/msys64/mingw64/bin/"
    }
  }
5reactions
bobbrowcommented, Mar 16, 2020

@Foadsf, you may not want to nuke your %PATH% by overwriting it with just the MinGW path. We created "CMT_MINGW_PATH" which will be added to the %PATH% when the environment is created.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - unable to determine what cmake generator to use-VS ...
If you have install cmake, setted up your project and you added it's path, try this Ctrl+shift+P and Type "cmake:reset cmake tools for ......
Read more >
VS Code: Unable to determine what CMake generator to use.
When I create a new project from samples in VS Code I get this error [variant] Loaded new set of variants [kit] Successfully...
Read more >
Unable to determine what CMake generator to use. : r/vscode
I installed CMake, which apparently is recommended for including libraries, and following a tutorial online leads me to hit a wall which so...
Read more >
vscode-cmake-tools/support - Gitter
"Unable to determine what CMake generator to use. Please install or configure a preferred generator, or update settings.json or your Kit configuration.
Read more >
CMake Kits — CMake Tools 1.4.0 documentation
Kits are mostly CMake-generator-agnostic, although Visual Studio kits will ... kits by creating a .vscode/cmake-kits.json file in the project directory.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found