Closed aiyolo closed 6 days ago
Thank you very much for reporting this issue; it has been recorded in our public bug tracker, where all further updates will be shared: Cannot customize cmakeprests.json. (issue #38)
Hi. After reviewing your request we came to the conclusion that the behavior is correct. The preset is checksum'ed and therefor any additional entries added get reverted/removed on reconfigure. We do this to make sure our preset is in a well defined state. If you want to add the CMAKE_TOOLCHAIN_FILE, you have a couple of options:
Add the entry into the CMakeUserPresets.json:
{
"version": 3,
"configurePresets": [
{
"name": "Debug-x64",
"displayName": "Debug (x64)",
"binaryDir": "\${sourceDir}/out/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_TOOLCHAIN_FILE": "\$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
"inherits": [
"Qt-Default"
]
},
{
"name": "Release-x64",
"displayName": "Release (x64)",
"binaryDir": "\${sourceDir}/out/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "\$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
"inherits": [
"Qt-Default"
]
},
... more code omitted here ...
}
If you need to share or commit your entry, you can also add an additional preset to the CMakePresets.json:
{
"version": 3,
"configurePresets": [
{
"hidden": true,
"name": "Qt",
"cacheVariables": {
"CMAKE_PREFIX_PATH": "$env{QTDIR}"
},
"vendor": {
"qt-project.org/Qt": {
"checksum": "wVa86FgEkvdCTVp1/nxvrkaemJc="
}
}
},
{
"hidden": true,
"name": "Toolchain",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
}
}
],
"vendor": {
"qt-project.org/Presets": {
"checksum": "67SmY24ZeVbebyKD0fGfIzb/bGI="
}
}
}
and inherit the preset in your CMakeUserPresets.json:
{
"version": 3,
"configurePresets": [
{
"name": "Debug-x64",
"displayName": "Debug (x64)",
"binaryDir": "${sourceDir}/out/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"inherits": [
"Qt-Default",
"Toolchain"
]
},
{
"name": "Release-x64",
"displayName": "Release (x64)",
"binaryDir": "${sourceDir}/out/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
},
"inherits": [
"Qt-Default",
"Toolchain"
]
},
... more code omitted here ...
}
For more information on CMake presets, please follow their official documentation: cmake-presets Thank you for your patience, and please let us know if you need further assistance.
The only thing I do is to add a cmake_toolchain_file in the cmakepresets.json generated by this extension, after I reconfigure project, this line is removed!