I've recently freshly installed Ubuntu 20.04, and VSCode, meant for c++. I added the C/C++, CMake and CMake Tools extensions. Then I cloned one of my old github repos for testing and tried to Cmake:configure from the command pallete, but I got this error.

Bad CMake executable "/snap/bin/cmake". Is it installed or settings contain the correct path (cmake.cmakePath)?

I've looked through the CMake tools extension github repo for answers, and it appears to be some kind of an issue regarding snaps? I'm not that sure what exactly they're talking about, but I got that its a bug in CMake Tools, however I didnt find a solution for this. Can anyone help me out?


You have to remove Snap'ed cmake by

snap remove cmake

and install deb-packaged version by

sudo apt-get update
sudo apt-get install cmake

sudo apt-add-repository universe
sudo apt-get install cmake-extras

and then restart VSCode.


The cmake version that comes with Snap is more recent on my Ubuntu 20.04.4 LTS:

$ apt show cmake
Package: cmake
Version: 3.16.3-1ubuntu1

while the Snap version I installed

cmake version 3.22.2

So I preferred to use /snap/cmake/current/bin/cmake as CMake Path (as recommended here: "It works when you use /snap/cmake/current/bin/cmake as CMake Path. All snap executables seem to be just symbolic links to /usr/bin/snap, and that seems to work fine when called from a terminal but apparently not from the CMake extension in VSCode ...").