presets: With multiple defined packagePresets, only first one can be used
Please excuse if I misunderstood this process, but there is currently so little information, and all my research and observation seems to indicate this is an issue.
Testing using CMake 3.26.0-rc6 Win10 with VS2022 and Ubuntu 22.04 with gcc11.3 and Ninja 1.11.1
I am made a CMakePreset.json file (at the bottom), I left just enough to hopefully show it should work, but some descriptions allude to deleted parts.
Steps: config, build, and test work both on Linux and Windows. However using the cpack with second (ZIP) preset, I get the following message
cpack --preset=ZIP --verbose
CPack: Enable Verbose
CPack Error: Cannot use presetAvailable package presets:
"TGZ"
If I switch the order of the presets, the packing will run as expected. I have observed the same issue on Windows, only the first preset can be run.
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 26,
"patch": 0
},
"configurePresets": [
{
"name": "defaultRelease",
"displayName": "default preset using vcpkg",
"description": "",
"binaryDir": "${sourceDir}/build/",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/"
}
},
{
"name": "vcpkgWin",
"inherits": "defaultRelease",
"displayName": "Windows preset using vcpkg",
"generator": "Visual Studio 17 2022"
},
{
"name": "vcpkgLinux",
"inherits": "defaultRelease",
"displayName": "Linux preset using vcpkg",
"generator": "Ninja"
}
],
"buildPresets": [
{
"name": "releaseWin",
"description": "",
"displayName": "releaseWin",
"configurePreset": "vcpkgWin",
"configuration": "Release"
},
{
"name": "releaseLinux",
"description": "",
"displayName": "releaseLinux",
"configurePreset": "vcpkgLinux",
"configuration": "Release"
}
],
"testPresets": [
{
"name": "testsWin",
"description": "",
"displayName": "testsWin",
"configurePreset": "vcpkgWin",
"output": {"outputOnFailure": true}
},
{
"name": "testsLinux",
"description": "",
"displayName": "testsLinux",
"configurePreset": "vcpkgLinux",
"output": {"outputOnFailure": true}
}
],
"packagePresets": [
{
"name": "TGZ",
"configurePreset": "vcpkgLinux",
"generators": [
"TGZ"
],
"output": {
"debug": false
}
},
{
"name": "ZIP",
"configurePreset": "vcpkgWin",
"generators": [
"ZIP "
],
"output": {
"debug": false
}
}
]
}