This might be tricky as the solution-level variables are not available to some parts of the build logic. Could you please clarify where exactly would you envision using this variable so that we could see if it could be supported?
The IDF_PATH should actually be handled by VisualGDB directly. Normally it takes the list of IDF checkouts from the toolchain directory, however if you are keeping a custom checkout together with your codebase, we could add a per-user list of IDF checkouts. So once you configure (once per development machine) that the “com.yourcompany.idf-patched” is located in c:\projects\idf, VisualGDB will find it automatically from all projects.
IMO $(SolutionDir) could be more flexible. My other project is nRF5x based and also keeps nRF SDK within my source tree (project is a few years old – using latest nRF SDK would be stupid idea as it most likely will break everything). Don’t recall details but $(SolutionDir) would also work in nRF case while ‘IDF checkout’ solution – no.
It is just a suggestion – I’ve workaround and it works for me.