microsoft / vscode-cmake-tools

CMake integration in Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=vector-of-bool.cmake-tools
MIT License
1.46k stars 450 forks source link

Ignore some root folders in a multi-root workspace #1069

Open jasongiss opened 4 years ago

jasongiss commented 4 years ago

Brief Issue Summary

It would be great to be able to set certain 'projects' (root folders) within a Multi-Root Workspace to be ignored with regards to the CMake build actions.

I have a Multi-Root workspace with a 'build_all' project (as used by my CI system), which pulls in several external CMake projects using ExternalProject_Add.

I have these external projects as separate root folders under my workspace, so that their Intellisense settings etc can be separately configured for development purposes. I don't want to build these individually - just from the build-all project.

This worked well before the Multi Root Workspace support was added (as the CMake extension just grabbed the first project in the workspace), but now if I go into the 'CMake' sidebar view, I can't (for example) configure a single project individually - I can only configure all. (I also have a load of entries in here which I don't care about)

Where I used to have one 'project' in the CMake view, I now see a lot, and I'd really like to be able to ignore those highlighted. image

emrainey commented 3 years ago

+1 this feature. It's quite annoying to not be able to have non-CMake package in the same Workspace as CMake packages due to this issue. A simple tag in the "folders" listing which indicates if the package should be interpreted as a CMake package might be all that is required.

t3fi commented 2 years ago

+1, I think I was looking for this feature - sort of.

In my case, I was first annoyed by source control activity not showing repositories from .gitignored sub-folders in "single-root" workspace. I've not found other solutions to this except the one explained here. This makes it to work via multi-root. but I shouldn't need it in first place. Anyway, somehow recursive repositories search in SCM side of vscode pulled me to try it out.

So, with that scenario as basis, SCM works but CMake doesn't. CMakeLists in subdir(s) configured as multi-root, but supposed to be managed by the parent (the real root) and stay hidden from CMake extension alone. I get it's kind of self-inflicted to first declare something as root/project and then start to ignore it per extenssion :D But in general, I would prefer all extensions to let me configure such things explicitly - i.e. disable roots from auto-detecting anything.

In CMake activity, the active target selection (hence also F7) works, but all other actions e.g. from under ...-menu (clean rebuild, clean reconfigure...) seem to default to first sub-directory or attempt to do it on both maybe - but failing to first in my case. Also 'autoSelectActiveDirectory' doesn't seem to affect.

danniesim commented 2 days ago

+1 this feature. It's quite annoying to not be able to have non-CMake package in the same Workspace as CMake packages due to this issue. A simple tag in the "folders" listing which indicates if the package should be interpreted as a CMake package might be all that is required.

Implemented what you mentioned: get the forked extension here