Hi Martin,
With something like the USBHost, I don't think the dependencies such as mbed-rtos should be bundled with it as children. If you think about the way you include libraries in a normal project, all the dependencies are linked separately.
I think it would make more sense if when you import USBHost it would say "Including this library will also require the inclusion of mbed-rtos and FATFileSystem, is this OK?" and then it imports those at the top level rather than as children. This would make more sense, because I often find myself importing something like USBHost into a project that is already using mbed-rtos, so then I have to delete one of the copies of mbed-rtos. It's just not the normal way to nest dependencies when you develop elsewhere.
I understand the ethos behind perhaps bundling these things together so you only have to import "one" thing, but I think the workaround above could be used.
As for how the exclusion could be worked, I think perhaps you could just right click on the folder and mark it as "exclude from build", this would be better than having to delete the folder, because of the implications with syncing the library.
There is actually a very good use case for this which involves setting options for something like USBHost or lwip. It's always a hassle changing the options because if you want to commit your program the old "if you want to commit changes to X you also need to commit changes to Y" comes up, but all you are doing is changing some lwip options. But if you could exclude a file from compilation, you could create your own "options.h" file and leave the one in lwip or whatever untouched.
Another suggestion would be to allow the setting of compilation flags. In many cases there is a debug option, and again if you edit this in the header of the included library, it just causes hassle committing the program, because it wants to commit the changes to the included files. But if this is just a #define, you could pass this in from the compiler.
Ashley
I looked around a bit and didn't see much chatter about adding an "exclude from build" option to files and folders in a program/library. IMO, when porting code it would be more helpful to do this than #ifdef 0 or delete bsp or hal files that don't pertain to mbed (causing compilation and linking errors).
Just a thought...