Closed Croydon closed 2 months ago
@Croydon, could you please add property "configuration": "release" in buildPresets for release-shared/release-static configuration and verify your issue again? We find that select one of the release- targets and build it in Code, we could get a release build, please see the below video. Thanks.
ENV:
VS code version: 1.88.1
CMake Extension version: v 1.17.17
Thank you @Evelyn-001!
Adding "configuration": "release"
works for VS Code and continues to work for VS.
I am assuming that this difference between VS Code and VS is, that VS prefers the Ninja
CMake generator which is single-configuration, while VS Code apparently(?) has no own preferences and uses whatever CMake itself prefers, which is the VS generator on Windows and the VS generator is a multi-generator. So specifying configuration
again selects the desired one then.
It is still annoying that "CMAKE_BUILD_TYPE": "Release"
from the configuration step is not respected automatically, but I am not sure which component would need to change for that. CMake itself, this extension here, ...?
@Croydon, we are glad to be hearing your issue has been fixed. This is by design based on CMake upstream commandline. In multi-config scenarios one must define a Build Preset in which they define the configuration field. This matches the command-line cmake behavior where if you simply run cmake --build it will build the debug configuration, you must run cmake --build --config
Brief Issue Summary
I have create a CMakePresets.json for a project, which can be found here: https://github.com/Croydon/enet/commit/538f4ec28c0ebca8bf9c23996d7d9173d17ffb89
With Visual Studio 2022, this Presets file does exactly what I am expecting from it. All four targets build what I want.
However, in Visual Studio Code (latest stable version with latest stable version of CMake Tools) it misbehaves, hence I am assuming that it might be a bug in the CMake Tools for Code.
When I select one of the
release-
targets and build it in Code, I will always get a debug build (again; works correctly in VS).It also sets an install path of
${sourceDir}/build/${presetName}/Debug
as some obvious indicator that it actually performs a debug build.For release-shared target:
For debug-shared target:
CMake Tools Diagnostics
Debug Log
Additional Information
Please let me know If I can provide any more useful information for that.
Thank you!
PS: On a second look, does this extension collide with another? I have The C/C++ Extension Pack (ms-vscode.cpptools-extension-pack) installed. And I see in the diagnostic data above that
cpptoolsIntegration
has"activeBuildType": "Debug",
but where is this coming from? I can't find such setting anywere.