I'm right now working on a Project integrating zephyr within a repository using CMake extensions.
The repository has following dir structure:
Now whenever I want to change the source directory, I have to reset the cmake.sourceDirectory
manually by writting to the settings.json file.
I wanted to ask, if someone knows a better approach. I was thinking on setting up a workflow where CMake opens a dialog for me to choose a source dir whenever I click on build.
Thx all for the help!
I searched for on how to introduce vars to settings.json (there is no way?).
I was thinking on creating a task, but well then I don't know exactly on how to get CMake to reopening the browse windows for the sourceDir.
CMake Tools supports specifying multiple source directories in the cmake.sourceDirectory
setting. It can take a string (path to single source directory), or an array of strings (array of paths to source directories). Ex. "cmake.sourceDirectory": ["${workspaceFolder}/1", "${workspaceFolder}/2"]
. Then you can switch between source directories by using the CMake: Select Active Folder
command in the command palette.
Note also that CMake Tools supports multi-root workspaces if you want to go that route.
I searched for on how to introduce vars to settings.json (there is no way?).
Right now, as far as I know, no. If there was, to get the dialog you want, you could use input variables.