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

Changing cmake path to an invalid location force user to restart VS Code to proceed

Open vinodappu opened this issue 1 year ago • 3 comments

Brief Issue Summary

I've changed cmake.path to a non existing location & saved the changes. I can see Bad cmake executable error coming, which is obvious.

Now I changed the cmake executable to existing one, still it's not working, giving bad cmake executable error, I had to restart VS Code to get rid of this issue.

image

image

CMake Tools Diagnostics

{
  "os": "win32",
  "vscodeVersion": "1.86.0",
  "cmtVersion": "1.16.32",
  "configurations": [
    {
      "folder": "c:\\Users\\test",
      "cmakeVersion": "unknown",
      "configured": false,
      "generator": "unknown",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": true,
    "activeBuildType": "Debug",
    "buildTypesSeen": [
      "Debug"
    ],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 3,
    "executablesCount": 1,
    "librariesCount": 1,
    "targets": [
      {
        "name": "test.elf",
        "type": "EXECUTABLE"
      },
      {
        "name": "create-objdump",
        "type": "UTILITY"
      },
      {
        "name": "test",
        "type": "STATIC_LIBRARY"
      }
    ]
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

Debug Log

No response

Additional Information

No response

vinodappu avatar Feb 06 '24 06:02 vinodappu

@vinodappu Thanks for letting us know. We'll mark this as a bug and place it on our backlog of bugs to fix.

gcampbell-msft avatar Feb 06 '24 15:02 gcampbell-msft

Related is when CMake is installed after launching VS Code. An example that I frequently encounter is when using a conda-based project in which the conda package manager is responsible for installing cmake.

Prior to installation of the conda-managed packages, VS Code tests for the cmake executable and fails. After this failure it never tests the executable again, even though the package may have been installed.

A preferable behavior would be to always attempt to run the cmake executable and reporting the error if it cannot be run, instead of testing once at startup.

oursland avatar May 08 '24 20:05 oursland

@vinodappu @gcampbell-msft We can reproduce this issue on latest version, you can get the details below.

ENV: VSCode: 1.89.0 CMake tools: v1.17.17 C/C++: v1.20.5

Repro steps:

  1. Open a folder
  2. Open settings UI and set the Cmake: Cmake Path to a non existing location, e.g., 'cmake1'
  3. Click F1 to run 'CMake: configure'
  4. Reset the Cmake: Cmake Path to original location, e.g., 'cmake'
  5. Click F1 to run “CMake: configure” and check if the configuration is successful

Expected result: It should be configured successfully

Actual result: The configuration did not succeed. And displays the error: “Bad CMake executable ‘cmake1’. image

Yingzi1234 avatar May 11 '24 03:05 Yingzi1234

@gcampbell-msft is there a PR that closed this issue?

oursland avatar Jun 03 '24 17:06 oursland

This commit: https://github.com/microsoft/vscode-cmake-tools/commit/6eb0121930d4b2222bb0538d94580e8e40861f69

gcampbell-msft avatar Jun 03 '24 18:06 gcampbell-msft

This addresses the situation in which changing a cmake path occurs, but does not address the situation in which a previously invalid path is made valid. I'll file a new issue for this.

oursland avatar Jun 03 '24 18:06 oursland