# СмакеPresets.json - conditional inheritance

**URL:** https://discourse.cmake.org/t/presets-json-conditional-inheritance/11386
**Category:** Usage
**Created:** [August 5, 2024, 3:02pm UTC](https://discourse.cmake.org/t/presets-json-conditional-inheritance/11386 "2024-08-05T15:02:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![KSergeyP](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/8baadc/32.png) [@KSergeyP](https://discourse.cmake.org/u/KSergeyP)
#### Post date: [August 5, 2024, 3:02pm UTC](https://discourse.cmake.org/t/presets-json-conditional-inheritance/11386/1 "2024-08-05T15:02:08Z")

</div>

It is necessary to build the project on different hosts (Windows, Linux). Target - bare metal and does not depend on the host.

I made a nested PresetsJson which has 2 subconfigurations with platform-specific settings:  
PlatformWindows  
PlatformLinux

Then in the main CMakePresets.json I created different configurations.  
Example:  
{  
“name”: “Debug”,  
“inherits”: “Platform${hostSystemName}”, or “inherits”: “Platform$env{hostSystemName}”,  
“displayName”: “Debug”,  
“description”: “Debug”,  
}

It does not work 🙂  
As I understand it, you cannot use env variables in “inherits”?

I also tried creating nested PresetsJson with different names for different platforms:  
PlatformWindows.json  
PlatformLinux.json  
“include”: [  
“Platform$env{hostSystemName}.json”,  
],

This also doesn’t work.

Is there a way to write basic Presets that can then be used depending on the platform?  
PS: there can be many final configurations, I don’t want to multiply their number by the number of hosts.  
I use Visual Studio Code

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [August 9, 2024, 7:12am UTC](https://discourse.cmake.org/t/presets-json-conditional-inheritance/11386/2 "2024-08-09T07:12:12Z")

</div>

see [Workflow Presets: We need support for macro expansion in inherits field - #5 by ClausKlein](https://discourse.cmake.org/t/workflow-presets-we-need-support-for-macro-expansion-in-inherits-field/8798/5) for an working example
