vscode-cmake-tools: Bad CMake executable "C:\Program Files\CMake\bin\cmake.exe".

Brief Issue Summary

I had been using the extension for several months with little issue. One day, it stopped working. I get this error: Bad CMake executable "C:\Program Files\CMake\bin\cmake.exe". Is it installed or settings contain the correct path (cmake.cmakePath)? That path is correct, and I can still run cmake from the command line using that absolute path, as well as by the command line finding it in my PATH.

Expected:

  1. Push Configure button
  2. Project is configured.

Apparent Behavior:

  1. Push Configure button
  2. Error pops up. (text given above).

CMake Tools Log

2019-05-16T00:08:57.844Z [debug] [rollbar] Updated Rollbar payload {"environment":"production","packageJSON":{"name":"cmake-tools","version":"1.1.3"},"client":{"code_version":"1.1.3"},"platform":"win32"}
2019-05-16T00:08:57.957Z [debug] [kit] Reading kits file C:\Users\joee\AppData\Local\CMakeTools\cmake-tools-kits.json
2019-05-16T00:08:57.957Z [debug] [kit] Not reading non-existent kits file: c:\Users\joee\dev\cmaketest\.vscode\cmake-kits.json
2019-05-16T00:08:57.994Z [info] [kit] Successfully loaded 12 kits from C:\Users\joee\AppData\Local\CMakeTools\cmake-tools-kits.json
2019-05-16T00:08:57.996Z [debug] [main] Safe constructing new CMakeTools instance
2019-05-16T00:08:57.996Z [debug] [variant] Constructing VariantManager
2019-05-16T00:08:57.998Z [debug] [main] Constructing new CMakeTools instance
2019-05-16T00:08:57.998Z [debug] [main] Starting CMakeTools second-phase init
2019-05-16T00:08:57.998Z [debug] [rollbar] Checking Rollbar permissions
2019-05-16T00:08:57.998Z [debug] [rollbar] Rollbar enabled?  true
2019-05-16T00:08:58.033Z [info] [variant] Loaded new set of variants
2019-05-16T00:08:58.034Z [debug] [main] CMakeTools instance initialization complete.
2019-05-16T00:08:58.036Z [debug] [kit] Reading kits file C:\Users\joee\AppData\Local\CMakeTools\cmake-tools-kits.json
2019-05-16T00:08:58.051Z [info] [kit] Successfully loaded 12 kits from C:\Users\joee\AppData\Local\CMakeTools\cmake-tools-kits.json
2019-05-16T00:08:58.063Z [debug] [kit] Not reading non-existent kits file: c:\Users\joee\dev\cmaketest\.vscode\cmake-kits.json
2019-05-16T00:08:58.739Z [error] [main] Failed to get version information for CMake during upgarde
2019-05-16T00:09:04.013Z [debug] [extension] [6342] cmake.configure started
2019-05-16T00:09:04.013Z [debug] [extension] Start selection of kits. Found 13 kits.
2019-05-16T00:09:04.013Z [debug] [extension] Opening kit selection QuickPick
2019-05-16T00:09:07.778Z [debug] [extension] User selected kit  {"label":"VisualStudio.14.0 - x86","description":"Using compilers for VisualStudio.14.0 (x86 architecture)","kit":{"name":"VisualStudio.14.0 - x86","visualStudio":"VisualStudio.14.0","visualStudioArchitecture":"x86","preferredGenerator":{"name":"Visual Studio 14 2015"}}}
2019-05-16T00:09:07.779Z [debug] [rollbar] Updated Rollbar payload {"kit":{"name":"VisualStudio.14.0 - x86","visualStudio":"VisualStudio.14.0","visualStudioArchitecture":"x86","preferredGenerator":{"name":"Visual Studio 14 2015"}}}
2019-05-16T00:09:07.779Z [debug] [main] Injecting new Kit into CMake driver
2019-05-16T00:09:07.781Z [debug] [main] Run configure  
2019-05-16T00:09:07.781Z [debug] [main] Saving open files before configure/build
2019-05-16T00:09:08.376Z [debug] [extension] [6342] cmake.configure finished (returned -1)
2019-05-16T00:09:38.911Z [debug] [extension] [9226] cmake.viewLog started
bug] [extension] [5962] cmake.viewLog started
2019-05-16T00:06:42.724Z [debug] [extension] [5962] cmake.viewLog finished (returned undefined)
2019-05-16T00:07:54.282Z [debug] [extension] [5563] cmake.configure started
2019-05-16T00:07:54.282Z [debug] [main] Run configure  
2019-05-16T00:07:54.282Z [debug] [main] Saving open files before configure/build
2019-05-16T00:07:54.894Z [debug] [extension] [5563] cmake.configure finished (returned -1)
2019-05-16T00:08:01.181Z [debug] [extension] [3999] cmake.configure started
2019-05-16T00:08:01.181Z [debug] [main] Run configure  
2019-05-16T00:08:01.182Z [debug] [main] Saving open files before configure/build
2019-05-16T00:08:01.769Z [debug] [extension] [3999] cmake.configure finished (returned -1)
2019-05-16T00:08:05.661Z [debug] [extension] [1908] cmake.configure started
2019-05-16T00:08:05.662Z [debug] [main] Run configure  
2019-05-16T00:08:05.662Z [debug] [main] Saving open files before configure/build
2019-05-16T00:08:06.260Z [debug] [extension] [1908] cmake.configure finished (returned -1)
2019-05-16T00:08:07.230Z [debug] [extension] [8321] cmake.configure started
2019-05-16T00:08:07.233Z [debug] [main] Run configure  
2019-05-16T00:08:07.233Z [debug] [main] Saving open files before configure/build
2019-05-16T00:08:07.790Z [debug] [extension] [8321] cmake.configure finished (returned -1)
2019-05-16T00:08:18.032Z [debug] [extension] [4776] cmake.viewLog started
2019-05-16T00:08:18.110Z [debug] [extension] [4776] cmake.viewLog finished (returned undefined)
2019-05-16T00:08:53.117Z [debug] [extension] [4252] cmake.resetState started
2019-05-16T00:08:53.118Z [debug] [extension] [4252] cmake.resetState finished (returned undefined)
2019-05-16T00:08:53.168Z [debug] [extension] Deactivate CMakeTools
e.setVariant finished (returned false)
2019-05-15T23:15:01.394Z [debug] [extension] [2983] cmake.setVariant started
2019-05-15T23:15:04.686Z [debug] [extension] [2983] cmake.setVariant finished (returned false)
2019-05-15T23:16:33.379Z [debug] [extension] [7517] cmake.setVariant started
2019-05-15T23:16:37.191Z [debug] [main] Active build variant changed
2019-05-15T23:16:37.194Z [debug] [main] Run configure  
2019-05-15T23:16:37.195Z [debug] [main] Saving open files before configure/build
2019-05-15T23:16:38.147Z [debug] [extension] [7517] cmake.setVariant finished (returned true)
2019-05-15T23:19:58.161Z [debug] [extension] [7558] cmake.configure started
2019-05-15T23:19:58.161Z [debug] [main] Run configure  
2019-05-15T23:19:58.162Z [debug] [main] Saving open files before configure/build
2019-05-15T23:19:58.795Z [debug] [extension] [7558] cmake.configure finished (returned -1)
2019-05-15T23:25:26.998Z [debug] [extension] [1615] cmake.configure started
2019-05-15T23:25:27.000Z [debug] [main] Run configure  
2019-05-15T23:25:27.000Z [debug] [main] Saving open files before configure/build
2019-05-15T23:25:27.638Z [debug] [extension] [1615] cmake.configure finished (returned -1)
2019-05-15T23:28:19.000Z [debug] [extension] [1460] cmake.clean started
2019-05-15T23:28:19.001Z [debug] [main] Run build clean
2019-05-15T23:28:19.637Z [fatal] [rollbar] Unhandled exception: Unhandled Promise rejection: clean Error: Impossible: CMake driver died immediately after successful configure {}
2019-05-15T23:29:42.344Z [debug] [extension] [6241] cmake.clean started
2019-05-15T23:29:42.345Z [debug] [main] Run build clean
2019-05-15T23:29:42.997Z [fatal] [rollbar] Unhandled exception: Unhandled Promise rejection: clean Error: Impossible: CMake driver died immediately after successful configure {}
2019-05-15T23:29:46.657Z [debug] [extension] [8631] cmake.build started
2019-05-15T23:29:46.658Z [debug] [main] Run build 
2019-05-15T23:29:47.276Z [fatal] [rollbar] Unhandled exception: Unhandled Promise rejection: build Error: Impossible: CMake driver died immediately after successful configure {}
2019-05-15T23:29:55.438Z [debug] [extension] [2746] cmake.configure started
2019-05-15T23:29:55.439Z [debug] [main] Run configure  

Platform and Versions

  • Operating System: Windows 10
  • CMake Version: 3.14.4
  • VSCode Version: 1.33.1
  • CMake Tools Extension Version: 1.1.3
  • Compiler/Toolchain: multiple.

Other Notes/Information

I uninstalled cmake, reinstalled the latest version. I uninstalled VS code, reinstalled the latest version. I may have had other Cmake extensions installed at some point, but they are all removed now. I already tried resetting the extension just now. No effect.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 41 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I have also faced on same problem.

My environment is below.

Ubuntu 18.04 TLS cmake 3.15.0 : /usr/local/cmake vscode 1.37.0

And, my error log in vscode is below.

Bad CMake executable “”. Is it installed or settings contain the correct path (cmake.cmakePath)?

I faced the same problem on windows. I fixed it by :

  1. removing cmake.cmakePath from the settings.json file
  2. resetting the extension (CTRL+SHIFT+P then “CMake: Reset CMake Tools Extension State (For troubleshooting)”
  3. checking that cmake is in my Path
  4. just putting “cmake” (without the brackets) in the extension settings GUI image

I installed cmake again like below.

$ sudo ./cmake-3.7.2-Linux-x86_64.sh
$ sudo mv cmake-3.7.2-Linux-x86_64 /opt
$ sudo ln -s /opt/cmake-3.7.2-Linux-x86_64/bin/* /usr/bin

After that, it seems that vscode recognize cmake and cmake-tools also recognize cmake.

I installed cmake as /usr/local/bin/cmake and set /usr/local/bin/ in my $PATH. But, in that case, it seemed that cmake was not detected automatically.

In above case, cmake tools ran after I set cmake path directly like below.

[Settings]->[Extensions]->[CMake Tools Configuration]->[CMake:Cmake Path] /usr/local/bin/cmake

Hey, it looks like a broken cmake path, or wrong cmake executable or missing Flfiles to start cmake.

What happens if you call cmake -version from a terminal inside of vscode?

What does the cmake.cmakePath settings looks like?