Understanding CMakePresets.json inheritance rules #2572
-
Hi, I'm not sure I understand the rules of inheritance for CMakePresets.json. Here is part of my json file:
There are 3 configuration presets, each inheriting from the one immediately above. My questions are for the net effect in configuration "ubuntu-all-release" (the top of the hierarchy). Q1 Will cacheVariables include variable 'PROJECT_VARIANT' or just 'CMAKE_BUILD_TYPE'? (i.e. does the top cacheVariables override all settings of the lower ones?) Q2 In the vendor settings is setting them to {} in this top config, overriding (i.e. removing) all the vendor settings below? Q3 If not, will vendor settings contain both copySourcesOptions.method and copySourcesOptions.exclusionList or only the latter? Q4 Is there a way of 'seeing' the net inherited values for verification? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Q1 - Values are overridden at the lower level, not at the object level (at least for Q2 - I would expect the same rules from Q1 to apply here, so for the example provided, I would not expect anything to be removed from the vendor settings because omitting a property is not deleting it. To delete settings you set them to Q3 - Similar to Q2, I need to see what Visual Studio decided for the remote settings (I know who to talk to - my team didn't implement this part) Q4 - Not currently. I thought we had an issue tracking this specifically, but I think #1945 is the closest we came to saying that. I would appreciate if you could open a feature request issue for this. |
Beta Was this translation helpful? Give feedback.
Q1 - Values are overridden at the lower level, not at the object level (at least for
cacheVariables
andenvironment
), so having different variables defined insidecacheVariables
should result in a mergedcacheVariables with both
PROJECT_VARIANTand
CMAKE_BUILD_TYPE` defined.Q2 - I would expect the same rules from Q1 to apply here, so for the example provided, I would not expect anything to be removed from the vendor settings because omitting a property is not deleting it. To delete settings you set them to
null
, though I don't know how well this was tested across all the properties and it's possible that there could be bugs here. I need to dig into this a bit more to see what Visual Studio…