microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.46k stars 446 forks source link

List of targets empty when using ~/... instead of /home/<user>/... as build dir #3541

Closed haferburg closed 1 month ago

haferburg commented 7 months ago

Brief Issue Summary

I just used the CMake: Quick Start to generate the sample project. I had set the Cmake: Build Directory setting to ~/build/${workspaceRootFolderName}/${buildType}, then generated with Ninja. The CMAKE_BUILD_TYPE was set to Debug.

When trying to configure the Build target in the Project status, the selection dropdown is empty.

image

When trying to configure the Debug or Launch target, the dropdown doesn't even appear at all.


Everything works fine when I set the Cmake: Build Directory setting to /home/andreas/build/${workspaceRootFolderName}/${buildType}.

CMake Tools Diagnostics

{
  "os": "linux",
  "vscodeVersion": "1.85.1",
  "cmtVersion": "1.16.32",
  "configurations": [
    {
      "folder": "/home/andreas/src/cmake-quick",
      "cmakeVersion": "3.28.1",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": false,
      "compilers": {}
    }
  ],
  "cpptoolsIntegration": {
    "isReady": true,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": true
    }
  ]
}

Debug Log

No response

Additional Information

No response

haferburg commented 7 months ago

I just realized: Workaround is to use ${userHome}/build/${workspaceRootFolderName}/${buildType}.

But it's still odd that there is no error message during configure. In my humble opinion it should either work or error out.

gcampbell-msft commented 7 months ago

@haferburg Thanks for the workaround! In the meantime, I would agree that this scenario should be better handled by the extension. I'll mark this as a bug, and we will place this on the backlog, with the intention to, once we are able to prioritize this, we can reproduce the issue and see what it going on.

Thanks!