vscode-cmake-tools icon indicating copy to clipboard operation
vscode-cmake-tools copied to clipboard

[Bug] "Bad CMake executable", even though it's available on the path

Open ivancuric opened this issue 4 months ago • 3 comments

Brief Issue Summary

I am using mise (https://mise.jdx.dev/) to manage my cmake installation on MacOS.

cmake is available on the path, and is evaluated both in the interactive and non-interactive shells using:

echo 'eval "$(mise activate zsh --shims)"' >> ~/.zprofile # this sets up non-interactive sessions
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc    # this sets up interactive sessions
➜ which cmake
/Users/ivan/.local/share/mise/installs/vfox-cmake/4.0.3/CMake.app/Contents/bin/cmake

CMake Tools Diagnostics

{
  "os": "darwin",
  "vscodeVersion": "1.105.1",
  "cmtVersion": "1.21.36",
  "configurations": [
    {
      "folder": "/Users/ivan/Dev/blinkid-next.worktrees/release/v7.6/packages/blinkid-wasm",
      "cmakeVersion": "unknown",
      "configured": false,
      "generator": "unknown",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

[main] Building folder: blinkid-wasm 
[rollbar] Unhandled exception: Unhandled Promise rejection: build Error: Build failed: Unable to configure the project {}
[extension] [2545] cmake.logDiagnostics started
[extension] [2545] cmake.logDiagnostics finished (returned undefined)

Additional Information

No response

ivancuric avatar Oct 27 '25 14:10 ivancuric

Hi @ivancuric, thank you for reporting this issue. We tried to check this issue on Mac OS darwin environment using Visual Studio Code v1.105.1 + CMake Tools v1.21.36. We installed mise and configured CMake 4.1.2, but we can't reproduce this issue. Could you please help us check if our repro steps are correct? If we missed something, please let us know. Thanks.

Image

yanghhhhhhh avatar Oct 30 '25 09:10 yanghhhhhhh

Hey, you're absolutely correct. The issue was that cmake wasn't in the path as I have opened the directory with the cmake package in a new window, as it needs to be the root directory.

VScode's terminal somehow evaluated mise from the parent directory that wasn't in the workspace window. Not sure how it was even able to do that. But the cmake extension (expectedly) saw that there was no mise.toml in the project structure so it didn't evaluate it.

Opening the package dir in a new VScode window, and launching the terminal shows that mise is aware of the mise.toml in the parent directory:

➜ mise config
Path                                               Tools                                             
~/.config/mise/config.toml                         node, npm:@antfu/ni, npm:adb-qc, npm:npkill,...   
~/Dev/blinkid-next.worktrees/release/v7.6/mise...  node, pnpm, python, uv, conan, ninja, vfox:cmake  

Do you have any ideas why this happens?

ivancuric avatar Oct 30 '25 12:10 ivancuric

@ivancuric Thank you for your reply.

  1. You mean that CMake Tools ignores .mise.toml during configuration and build, using /usr/local/bin/cmake (version 4.1.0), but when running in the terminal, it recognises mise and uses the cmake installed within mise (version 4.1.2), right?
  2. The expected result is that it uses the CMake version (4.1.2) installed via mise when generating the cache and building the project, right?

If we have misunderstood you, please let us know. Thank you.

yanghhhhhhh avatar Oct 31 '25 06:10 yanghhhhhhh