presets: packagePresets options in CMakePreset not taken in account
I am using a CMakePresets.json in order to generate an artefact of my project. I defined various options on the buildPresets step to custom my output artefact. Nevertheless, some of the options set are not being taken in account (packageName and packageVersion). My artefact is created with the default value for these options instead.
I might have missed something or misunderstood the behavior of the buildPreset step of the CMakePresets.json
Here is my CMakeLists.txt
cmake_minimum_required( VERSION 3.25 )
project( AA )
add_executable( ${PROJECT_NAME} main.cpp )
install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/ DESTINATION . )
include( CPack )
and my CMakePresets.json
{
"version": 6,
"cmakeMinimumRequired":
{
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets":
[
{
"name": "VS2022_x64",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/",
"architecture":
{
"value": "x64",
"strategy": "set"
}
}
],
"buildPresets":
[
{
"name": "Release",
"configurePreset": "VS2022_x64",
"configuration": "Release"
}
],
"packagePresets":
[
{
"name": "Packaging",
"configurePreset": "VS2022_x64",
"generators": [ "ZIP" ],
"configurations": [ "Release" ],
"packageName": "MYPKG",
"packageVersion": "2.0.0",
"packageDirectory": "${sourceDir}/"
}
],
"workflowPresets":
[
{
"name": "packaging",
"steps":
[
{
"type": "configure",
"name": "VS2022_x64"
},
{
"type": "build",
"name": "Release"
},
{
"type": "package",
"name": "Packaging"
}
]
}
]
}
Edited by Brad King