vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Visual Studio Generator - packagePresets: Use multi-configuration builds
Brief Issue Summary
It is possible to pass multiple build configurations via a packagePresets. But CPack is run with the selected buildPresets and additionaly with the given configurations: [proc] Executing command: C:/msys64/ucrt64/bin/cpack.exe -C Release -C "Debug;Release" -B NuGet
The package preset:
"packagePresets": [
{
"name": "windows-x64-nuget",
"displayName": "NuGet Package",
"description": "Create a NuGet Package",
"configurePreset": "default",
"inheritConfigureEnvironment": true,
"packageDirectory": "NuGet",
"configurations": ["Debug", "Release"]
}
],
CMake Tools should run a build with "Release" and "Debug", but it only runs for "Debug". Hence packaging fails, as "Release" build is missing.
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response
@kuch3n We are trying to reproduce this issue based on the code you provided, we ran into the problem in the screenshot below, when I try to install it on the NSIS website, it says that I can't access this page, is it mandatory to install NSIS in order to reproduce this issue? If not can you give me some more detailed steps and suggestions? Looking forward to receive your reply!
@v-frankwang you could use the Visual Studio Generator, too.
CMakePresets.json
{
"$schema": "https://cmake.org/cmake/help/latest/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json",
"version": 8,
"configurePresets": [
{
"name": "default",
"hidden": false,
"displayName": "Default x64",
"description": "Default build x64",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/",
"architecture": {
"value": "x64"
},
"cacheVariables": {
"CMAKE_VS_NUGET_PACKAGE_RESTORE": {
"type": "BOOL",
"value": "ON"
}
},
"environment": {
"PATH": "$penv{PATH};C:/nuget"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"hostOS": [ "Windows" ],
"intelliSenseMode": "windows-msvc-x64"
}
}
}
],
"packagePresets": [
{
"name": "windows-x64-nuget",
"displayName": "NuGet Package",
"description": "Create a NuGet Package",
"configurePreset": "default",
"inheritConfigureEnvironment": true,
"packageDirectory": "NuGet",
"configurations": [ "Debug", "Release", "RelWithDebInfo" ]
}
]
}
@kuch3n Thank you very much for your reply, we used the CMakePresets.json file you provided to solve the problem I ran into, but mine seems to be able to be packaged successfully, here are our results along with the details:
Isn't it just building for Debug? If i use "Run CPack" only the active build preset is build. With [[default]] Debug gets build.
"Run CPack" should run a build for each configuration, e.g. cmake --build . --config Debug and cmake --build . --config RelWithDebInfo. Instead only Debug or the configuration in the build preset is build
@gcampbell-msft According to @kuch3n 's description this comment: https://github.com/microsoft/vscode-cmake-tools/issues/4096#issuecomment-2378638486 reproduces his problem, when adding multiple configuration versions to the “configurations” property in a PackagePresets, the output window should show running a build for each configuration when running the Run:Cpack command. Example:[proc] Executing command: XX/bin/cpack.exe -C Release -C "Debug;Release" -B NuGet,We're not sure if this is a bug or not and hope you could give some advice!
@v-frankwang @kuch3n This surely sounds like a bug worth investigating, I'll mark the issue as such and place it on our backlog. Thanks!