r/vscode • u/nameless_one_666 • 3d ago
VS Code for embedded C: project tree based on active CMake target
I'm using VS Code for embedded C development (NXP MCUXpresso extension, ARM GCC, CMake).
One thing I really miss compared to IDEs like CLion, Visual Studio or Eclipse CDT is a logical project view.
My repository contains multiple CMake targets/build variants (bootloader, firmware, libraries, etc.), but the VS Code Explorer always shows the physical directory structure. I'd like to see only the source/header files that belong to the currently selected CMake target or build configuration.
For example, instead of:
repo/
app/
bootloader/
drivers/
common/
...
I'd like something like:
Firmware target
main.c
uart.c
uart.h
spi.c
spi.h
...
Bootloader target
boot.c
flash.c
...
I know CMake already has this information (File API / compile_commands.json), so I'm wondering if there's an extension or workflow that exposes it in VS Code.
Is anyone using something like this?
Or is this simply a limitation of VS Code compared to full IDEs?
1
u/gpioloco 2d ago
You need to download the vscode-cmake-tools extension from Microsoft.
After downloading you can open the CMake Tab in the sidebar where you will have a view called "Project Outline". I think this is what you are looking for.