-
Notifications
You must be signed in to change notification settings - Fork 430
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
Release target, Debug output #3829
Comments
|
Ok, but VC is only building a debug exe. Why wouldn't it be buidling all types? How do I get a release build? And what about this CMAKE_BUILD_TYPE_INT being set to debug? What is its purpose and how is it set to "release"? |
I'll need to set up a test case to double check, but to answer your question quickly, I believe you will need to add Starting with the information you shared earlier, it would like something like this (not tested, there could be a stray comma somewhere 😄) {
"version": 3,
"configurePresets": [
{
"name": "vs",
"displayName": "VS Custom preset",
"description": "Sets Visual Studio generator, build and install directory",
"generator": "Visual Studio 17 2022",
"binaryDir": "${workspaceFolder}/build/${presetName}",
"architecture": {
"value": "x64",
"strategy": "set"
},
"cacheVariables": {
"BOOST_ROOT": "G:/dev/boost_1_85_0"
}
}
],
"buildPresets": [
{
"name": "vs_debug",
"configurePreset": "vs",
"configuration": "Debug"
},
{
"name": "vs_release",
"configurePreset": "vs",
"configuration": "Release"
}
]
} |
I don't see any documentation for it, so I suppose it is an internal variable and probably matches the first build type in the |
You're almost there. The one correction is that it is actually one to one for single-config generators like Ninja. So your presets file would look more like this: {
"version": 6,
"configurePresets": [
{
"name": "VS_x64",
"hidden": false,
"generator": "Visual Studio 17 2022",
"binaryDir": "${workspaceFolder}/build/${presetName}",
"description": "Visual build.",
"cacheVariables": {
"BOOST_ROOT": "G:/dev/boost/boost_1_85_0"
}
},
{
"name": "Ninja_x64_Debug",
"hidden": false,
"generator": "Ninja",
"binaryDir": "${workspaceFolder}/build/${presetName}",
"description": "Ninja build.",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
"BOOST_ROOT": "G:/dev/boost/boost_1_85_0",
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "Ninja_x64_Release",
"hidden": false,
"generator": "Ninja",
"binaryDir": "${workspaceFolder}/build/${presetName}",
"description": "Ninja build.",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
"BOOST_ROOT": "G:/dev/boost/boost_1_85_0",
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "Release_VC",
"hidden": false,
"description": "",
"displayName": "",
"configuration": "Release",
"configurePreset": "VS_x64"
},
{
"name": "Debug_VC",
"hidden": false,
"description": "",
"displayName": "",
"configuration": "Debug",
"configurePreset": "VS_x64"
}
]
} It's somewhat confusing but an unfortunate artifact of the difference between single-config generators and multi-config generators.
|
Ok, now this makes sense. However, I need to urge Microsoft they need to do a better job at explaining how "buildPresets" and "configurePresets" work in the IDE. For example, this needs to be better explained:
Unfortunately, the CMake documentation doesn't make these real-use-case very clear. I was coming from Mac Visual Code and everything is working correctly. But this is because it uses "Unix makefiles" which is single-config generator and I was convinced the Visual Code and CMake on Windows was broken. Thanks for the clarification! Patrick |
I've almost encountered the same issue as you, and these discussions have now helped me understand. I couldn't agree with you more; the documentation indeed lacks some crucial (and conspicuous) explanations. |
@inkbottle-9 Thank you very much for your reply, our developers will continue to improve this document! |
@inkbottle-9 @tengai650 Thanks for the feedback. We've made notes on our side, but to best help move this forward, could you also create an issue on the Kitware repository so that they can be made aware of this feedback as well? |
Brief Issue Summary
Target is Release by setting "CMAKE_BUILD_TYPE": "Release" in the CMakePresets.json file.
using the CMake Debugger I see inconsistent values set:
Output from build:
[build] Building Custom Rule G:/dev/cmaketest/CMakeLists.txt
[build] main.cpp
[build] cmaketest.vcxproj -> G:\dev\cmaketest\bin\Debug\cmaketest.exe
CMake Tools Diagnostics
Debug Log
No response
Additional Information
configurePresets": [
{
"name": "vs_release",
"displayName": "VS Release Custom preset",
"description": "Sets Visual Studio generator, build and install directory",
"generator": "Visual Studio 17 2022",
"binaryDir": "${workspaceFolder}/build/${presetName}",
"architecture": {
"value": "x64",
"strategy": "external"
},
"cacheVariables": {
"BOOST_ROOT": "G:/dev/boost_1_85_0",
"CMAKE_BUILD_TYPE": "Release"
}
}
]
The text was updated successfully, but these errors were encountered: