Fix cmake.installPrefix not being passed to CMake when using presets#4706
Draft
Fix cmake.installPrefix not being passed to CMake when using presets#4706
cmake.installPrefix not being passed to CMake when using presets#4706Conversation
Fixes #4358 Move installPrefix expansion out of the non-preset-only block in _refreshExpansions() so it runs for both preset and non-preset modes. Add CMAKE_INSTALL_PREFIX handling in generateConfigArgsFromPreset(), following the same pattern as CMAKE_EXPORT_COMPILE_COMMANDS. Update checkConfigureOverridesPresent() to include installPrefix. Co-authored-by: hanniavalera <90047725+hanniavalera@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix cmake.installPrefix not passed to CMake presets
Fix Feb 9, 2026
cmake.installPrefix not being passed to CMake when using presets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change addresses item #4358
This changes visible behavior
The following changes are proposed:
installPrefixexpansion in_refreshExpansions()out of theif (!this.useCMakePresets)block sothis._installDiris populated regardless of preset usageCMAKE_INSTALL_PREFIXtogenerateConfigArgsFromPreset(), following the same precedence pattern asCMAKE_EXPORT_COMPILE_COMMANDS: presetcacheVariables>configureArgs>cmake.installPrefixsettinginstallPrefixincheckConfigureOverridesPresent()so the override notification fires when this setting is active with presetsThe purpose of this change
cmake.installPrefixwas silently ignored when using presets because:_refreshExpansions()only expanded it inside the non-preset branch, leaving_installDirnullgenerateConfigArgsFromPreset()never readinstallDirto emit-DCMAKE_INSTALL_PREFIXThe non-preset path in
generateConfigArgsFromSettings()→generateCMakeSettingsFlags()already handled this correctly.Other Notes/Information
Precedence (highest → lowest):
cacheVariables.CMAKE_INSTALL_PREFIX-DCMAKE_INSTALL_PREFIXincmake.configureArgscmake.installPrefixVS Code settingWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
2wrvsblobprodwus2180.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)40vvsblobprodwus2135.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)b15vsblobprodwus2164.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)b53vsblobprodwus2154.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)d94vsblobprodwus2119.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)k4pvsblobprodwus2140.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)n6wvsblobprodwus2123.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)p2tvsblobprodwus2189.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)v41vsblobprodwus2175.vsblob.vsassets.io/home/REDACTED/work/_temp/ghcca-node/node/bin/node node /usr/local/bin/yarn install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>[Bug]
cmake.installPrefixis not passed to CMake when using presets</issue_title><issue_description>### Brief Issue Summary
cmake.installPrefixis not passed to CMake asCMAKE_INSTALL_PREFIXwhen using presets. Here is the minimal project setting for reproducing the problem.CMakeLists.txt
CMakePresets.json
{ "version": 6, "cmakeMinimumRequired": { "major": 3, "minor": 25, "patch": 0 }, "configurePresets": [ { "name": "default" } ] }.vscode/setting.json
{ "cmake.installPrefix": "/some_path", "cmake.loggingLevel": "debug" }I expect
message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")this line shows/some_path, but it show the system(cmake)'s default value (/usr/localin my case).CMake Tools Diagnostics
{ "os": "linux", "vscodeVersion": "1.98.2", "cmtVersion": "1.19.52", "configurations": [ { "folder": "~/test_cmake_installdir", "cmakeVersion": "3.26.4", "configured": true, "generator": "Unix Makefiles", "usesPresets": true, "compilers": { "C": "~/anaconda3/bin/x86_64-conda-linux-gnu-cc", "CXX": "~/anaconda3/bin/x86_64-conda-linux-gnu-c++" } } ], "cpptoolsIntegration": { "isReady": true, "hasCodeModel": false, "activeBuildType": "", "buildTypesSeen": [ "" ], "requests": [], "responses": [], "partialMatches": [], "targetCount": 0, "executablesCount": 0, "librariesCount": 0, "targets": [] }, "settings": [ { "communicationMode": "automatic", "useCMakePresets": "auto", "configureOnOpen": true } ] }Debug Log