cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube CMake Support Auto-Detects Non-STM32 Workspaces Due to Parent .settings Folder

parmi93
Associate II

The STM32Cube CMake Support extension treats workspaces as STM32Cube projects when a folder higher up in the directory tree (above the workspace folder) contains the files .settings/bundles.store.json and .settings/bundles-lock.store.json.

For example, given a tree like this:

/
├── .settings
│   ├── bundles.store.json
│   └── bundles-lock.store.json
│
└── path
    └── to
        └── generic_cmake_project
             ├── CMakeLists.txt
             ├── generic_cmake_project.code-workspace
             └── lib.c

If the user opens the workspace generic_cmake_project.code-workspace, the STM32Cube CMake Support extension automatically creates the file .vscode/settings.json with the following content:

{
    "cmake.cmakePath": "cube-cmake",
    "cmake.configureArgs": [
        "-DCMAKE_COMMAND=cube-cmake"
    ]
}

and modifies the generic_cmake_project.code-workspace file by adding the following settings:

	"settings": {
		"stm32cube-ide-clangd.path": "cube"
	},

On the other hand, if the user opens the workspace in "folder mode" (File > Open Folder...), the STM32Cube CMake Support extension automatically creates the file .vscode/settings.json with the following content:

{
    "cmake.cmakePath": "cube-cmake",
    "cmake.configureArgs": [
        "-DCMAKE_COMMAND=cube-cmake"
    ],
    "stm32cube-ide-clangd.path": "cube"
}

All of this happens simply because higher up in the directory tree there are the files .settings/bundles.store.json and .settings/bundles-lock.store.json, which have nothing to do with the workspace itself.

Note that when opening this workspace, the pop-up in the bottom-right corner - "Would you like to configure discovered CMake project(s) as STM32Cube project(s)?" - does not even appear; the project is immediately treated as an STM32Cube project.

The correct behavior should be that the user is prompted via the bottom-right pop-up to choose whether to configure the discovered CMake project as STM32Cube project, but this prompt never appears.

Moreover, even adding the setting "stm32cube-ide-build-cmake.ignoreCubeProjectDiscovery": true in both the .vscode/settings.json file and in generic_cmake_project.code-workspace has no effect, although this setting should not even be necessary, since the STM32Cube CMake Support extension should ask the user whether they want to configure the project as an STM32Cube project.

 

Attached is a small example project that reproduces the issue.

1 REPLY 1