Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmakeExecutable is not respected when switching between presets #2791

Closed
0x6e opened this issue Oct 13, 2022 · 2 comments · Fixed by #3491
Closed

cmakeExecutable is not respected when switching between presets #2791

0x6e opened this issue Oct 13, 2022 · 2 comments · Fixed by #3491
Assignees
Labels
bug a bug in the product Feature: presets
Milestone

Comments

@0x6e
Copy link

0x6e commented Oct 13, 2022

Brief Issue Summary

cmakeExecutable is respected for the first preset that VS Code is opened with, however when I switch presets and configure/build, the CMake executable from the previous preset is still being used.

My use case is cross compiling for x86_64 on Apple silicon. I have native presets, where "cmakeExecutable": "/opt/homebrew/bin/cmake". I also have cross-compiling presets where "cmakeExecutable": "/usr/local/Cellar/cmake/3.24.2/bin/cmake". When I switch between them my CMake executable is not changed.

CMake Tools Diagnostics

{
  "os": "darwin",
  "vscodeVersion": "1.72.1",
  "cmtVersion": "1.12.27",
  "configurations": [
    {
      "folder": "<redacted>",
      "cmakeVersion": "3.24.2",
      "configured": true,
      "generator": "Ninja",
      "usesPresets": true,
      "compilers": {
        "C": "/Library/Developer/CommandLineTools/usr/bin/cc",
        "CXX": "/Library/Developer/CommandLineTools/usr/bin/c++"
      }
    }
  ],
  "cpptoolsIntegration": {
    "isReady": false,
    "hasCodeModel": false,
    "activeBuildType": "",
    "buildTypesSeen": [],
    "requests": [],
    "responses": [],
    "partialMatches": [],
    "targetCount": 0,
    "executablesCount": 0,
    "librariesCount": 0,
    "targets": []
  },
  "settings": [
    {
      "communicationMode": "automatic",
      "useCMakePresets": "auto",
      "configureOnOpen": null
    }
  ]
}

Debug Log

// Configure with a cross preset
[main] Configuring folder: <redacted> 
[main] Saving open files before configure/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[cmakefileapi-driver] Configuring using preset
[cmakefileapi-driver] Invoking CMake /usr/local/Cellar/cmake/3.24.2/bin/cmake with arguments
                                     ^ x86_64 cmake is being used, as requested
// ...
[extension] [2131] cmake.configure finished (returned 0)

// Select a native preset...
[extension] [2100] cmake.selectConfigurePreset started
[presetController] Start selection of configure presets. Found 60 presets.
[presetController] Opening configure preset selection QuickPick
[presetController] User selected configure preset "local-macos-dev-arm64-master"
[main] Resolving the selected configure preset
[main] Loading new configure preset into CMake driver
[driver] Switching to configure preset: local-macos-dev-arm64-master
[driver] CMakeDriver configure preset set to local-macos-dev-arm64-master
[main] Resolving the selected build preset
[extension] Not updating the configuration provider because "C_Cpp.intelliSenseEngine" is set to "Disabled"
[main] Loading new build preset into CMake driver
[driver] Switching to build preset: __defaultBuildPreset__
[driver] CMakeDriver build preset set to __defaultBuildPreset__
[main] Resolving the selected test preset
[main] Resolving the selected test preset
[main] Loading new test preset into CMake driver
[driver] Switching to test preset: <redacted>
[driver] CMakeDriver test preset set to <redacted>
[extension] [2100] cmake.selectConfigurePreset finished (returned true)

// Then configure with the native preset...
[main] Configuring folder: <redacted> 
[main] Saving open files before configure/build
[driver] Start configure 
[driver] Running pre-configure checks and steps
[cmakefileapi-driver] Configuring using preset
[cmakefileapi-driver] Invoking CMake /usr/local/Cellar/cmake/3.24.2/bin/cmake with arguments
                                     ^ x86_64 cmake is still being used

Additional Information

No response

@elahehrashedi
Copy link
Contributor

Thank you for opening this issue, we will look into it.

@elahehrashedi elahehrashedi added this to the On Deck milestone Oct 14, 2022
@elahehrashedi elahehrashedi added Feature: presets bug a bug in the product labels Oct 14, 2022
@timofeev-n
Copy link

I confirm the problem.
Very annoying when working with different platforms. My case: often need to change the configuration between the desktop assembly and (for example) emsdk.
Each platform has its own cmake executable tool (specified within CMakePresets.json) but it doesn't applied until VSCode's windows is reloaded.

@github-project-automation github-project-automation bot moved this to Triage Needed in CMake Tools Nov 29, 2023
@gcampbell-msft gcampbell-msft moved this from Triage Needed to Pending Prioritization in CMake Tools Nov 29, 2023
@gcampbell-msft gcampbell-msft modified the milestones: On Deck, 1.17 Dec 12, 2023
@gcampbell-msft gcampbell-msft moved this from Pending Prioritization to Ready to be Assigned in CMake Tools Dec 12, 2023
@gcampbell-msft gcampbell-msft self-assigned this Dec 13, 2023
@gcampbell-msft gcampbell-msft moved this from Ready to be Assigned to In Progress in CMake Tools Dec 14, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Completed in CMake Tools Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug a bug in the product Feature: presets
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

4 participants