I run CMake: Select Variant
to select Relaese
and CMake: Configure
to update buid/CMakeCache.txt
which reflects the variant:
CMAKE_BUILD_TYPE:STRING=Release
CMake extension is VSCode shows Release
in the Configure
project status. However, the build always output the build artifacts in x64/Debug
folder and the binaries are built with CMAKE_CXX_FLAGS_DEBUG
instead of CMAKE_CXX_FLAGS_RELEASE
as I check using file
command and it shows with debug_info, not stripped
I see Release
in VSCode terminal output:
build task started....
/usr/bin/cmake --build /usr/src/MyApp/build --config Release --target all --
However, towards the end of the build the executables are linked and built in the Debug
folder:
[6/6 100% :: 11.014] Linking CXX executable /usr/src/MyApp/x64/Debug/Console
CMake: Log Diagnostics
:
{
"os": "linux",
"vscodeVersion": "1.94.2",
"cmtVersion": "1.19.52",
"configurations": [
{
"folder": "/usr/src/MyApp",
"cmakeVersion": "3.30.3",
"configured": true,
"generator": "Ninja",
"usesPresets": false,
"compilers": {
"C": "/usr/bin/gcc",
"CXX": "/usr/bin/g++"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Release",
"buildTypesSeen": [
"Debug"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 31,
"executablesCount": 2,
"librariesCount": 1,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
When I run CMake: Configure
from VSCode command palette:
[cpptools] The build configurations generated do not contain the active build configuration. Using "Debug" for CMAKE_BUILD_TYPE instead of "Release" to ensure that IntelliSense configurations can be found
According to documentation --config <cfg>
works for
"For multi-configuration tools, choose configuration <cfg>."
But in your preset defined "generator": "Ninja" which is not multi-configuration tool.
My guess is it should be "Ninja Multi-Config".