You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding a CMakePresets.json file causes settings (user/remote/workspace) to be eventually ignored.
Create a project, add a single cpp file and a CMakeLists.txt to build it. In vscode, set the 'workspace' setting for 'cmake: build directory' to some unique path. Build and it will store objects in that path.
Add a CMakePresets.json file, define a preset. Choose a different compiler (clang vs. gcc for instance). Clean and build. It will store objects in the path defined in the 'cmake: build directory' as before.
Close directory, open it again. Now the project is starting out with the CMakePresets.json file present. Build the project: it will store the objects in ${sourceDir}/out/build/$preset-name. It now ignores the 'cmake: build directory' setting at the workspace (and user or remote level). In fact, many settings for cmake: are now ignored, not just the build directory.
This behavior persists until the CMakeUserPresets.json file is removed and vscode is restarted on that directory, then the behavior goes back to normal.
Essentially, a cmake preset causes cmake settings to be ignored. I would expect settings like 'build directory', or 'parallel jobs' if present in the vscode cmake extension, to take precedence over the preset as defined, but that does not seem to be the case.
Thanks for the report. This is related to #1836, and we plan to more holistically evaluate how settings from VS Code should interact with settings from CMakePresets in an upcoming release. I'm merging this issue with #1836.
Sorry for necro-ing, but for anyone else still struggling with build dir settings: #1836 and #3537 added support for overriding some CMakePresets settings, but not all.
In particular cmake.buildDirectory is not overridden: the build objects still go into ${sourceDir}/out/build/$preset-name instead of the Build Directory in the extension settings.
For reference, the specific fields that are supported:
cmake.environment (any cmake command)
cmake.configureArgs (configure)
cmake.configureEnvironment (configure)
cmake.buildArgs (build)
cmake.buildEnvironment (build)
cmake.buildToolsArgs (build, but specific to the build tool)
Brief Issue Summary
Adding a CMakePresets.json file causes settings (user/remote/workspace) to be eventually ignored.
Create a project, add a single cpp file and a CMakeLists.txt to build it. In vscode, set the 'workspace' setting for 'cmake: build directory' to some unique path. Build and it will store objects in that path.
Add a CMakePresets.json file, define a preset. Choose a different compiler (clang vs. gcc for instance). Clean and build. It will store objects in the path defined in the 'cmake: build directory' as before.
Close directory, open it again. Now the project is starting out with the CMakePresets.json file present. Build the project: it will store the objects in ${sourceDir}/out/build/$preset-name. It now ignores the 'cmake: build directory' setting at the workspace (and user or remote level). In fact, many settings for cmake: are now ignored, not just the build directory.
This behavior persists until the CMakeUserPresets.json file is removed and vscode is restarted on that directory, then the behavior goes back to normal.
Essentially, a cmake preset causes cmake settings to be ignored. I would expect settings like 'build directory', or 'parallel jobs' if present in the vscode cmake extension, to take precedence over the preset as defined, but that does not seem to be the case.
CMake Tools Diagnostics
Debug Log
Additional Information
No response
The text was updated successfully, but these errors were encountered: