Hi @arunkumar_g,
To summarize, right now, the extension relies on the API provided by CMakeTools extension for building projects. Also, extension modifies the CMake presets files to supply required values for variables such as ARMGCC_DIR, SdkRootDirPath, and Python virtual environment settings, which are essential for the build process. In doing so, it introduces absolute paths tied to the local development environment. This makes the presets environment-specific, reducing their portability and making them unsuitable for sharing through version control systems like Git.
In the June release, we plan to introduce support for the “west” build. Since this process will be entirely managed by the extension, we’ll be able to pass all the necessary parameters to the west command and set the required environment variables. As a result, the extension will no longer need to modify the presets. Of course, this will only help if you are using a project based on a repository that has “west” support (like MCUXpresso SDK, Zephyr, Matter, etc.). Current build system will continue to be available and supported. The user will be able to switch between the two from the project settings.
If you are using a pure CMake project for which west is not a solution, we need to send the environment variables another way.
We investigated multiple solutions for this:
- Using settings like "cmake.environment", "cmake.configureEnvironment", and "cmake.buildEnvironment" would be a very good option, since the values provided here would not need to be absolute paths. Unfortunately, these options do not work with presets. Another issue with this approach is that if users want to build the project from the command line, they will have to set the environment variables manually before launching the build.
- In tasks.json, it is also possible to set environment variables for the CMake task, but again it seems that these are not passed to the build process.

- Use CMakeUserPresets.json. Its purpose is to store local, machine-specific build, configure, and test settings. This will work for non-sysbuild projects, will contain absolute paths (which in this case should be acceptable), and will need to be placed in your project. It should also be added to .gitignore.
For sysbuild projects, the source directory is inside the repository rather than in the project itself. The CMakeUserPresets.json file should be placed in the source directory, i.e., in the repository. The one in the repo will likely need to include one from the project, thus allowing different settings for each project.
Please note that in this scenario the extension will have to meddle with the CMakeUserPresets.json to add/define those variables.
This last one is the one we are planning to implement.
Regards,
Dragos.