Encountered lousy boo-boo in arduino IDE generated compilation commands

I've fought this issue for quite some time. It is totally brain dead to base the include path for everything
based on the headers "noticed" in the users sketch, particularly when it comes to libraries.

My opinion and preference would be to modify the IDE so that
the users personal library directory as well as the Arduino distribution directory is
added to the include path.

That way any code could include headers from any library by simply referencing the library's directory.

Example:
To include the Wire.h header file instead of using
#include <Wire.h>
it would be:
#include <Wire/Wire.h>
For spi it would be:
#include <SPI/SPI.h>

etc...
This would solve the issue you are seeing and make it really easy for libraries to reference other classes in other libraries,
which today really doesn't work unless the user adds the include files to his sketch,
which makes no sense since the sketch doesn't need it
but it does have the side effect of adding the specific library's directory to the include path.

If the existing goofy include path stuff was still done, but these two additional directories were added,
then naive users could continue to do their header includes the way they are now,
and those developing libraries or additional modules could use the library directory references to include
the needed headers without the users sketch having to include the headers.

It would be a very small backward compatible transparent change to the IDE that would add new
functionality going forward for those developing more complex s/w like libraries that depend
on or use other libraries.

--- bill