OK, sorry, I assumed you used the IDE - it seems to be the "popular" choice.
That's a good thing instead. What has been pointed out is also valid for the IDE build system. Because the IDE mimics what has been done from command line (or viceversa, you choose
).
What is confusing to me is that the include file behaviour was changed a couple of years ago, to act like in "other" compilers. A couple of years is a long time, so I don't remember the exact details, but the setup was similar to yours, and then the *only working solution* was to use the current directory as the reference point. Maybe this is only correct in some cases, but at the moment I don't have enough information to see the difference to other cases...
I will try to set up a test case, but this will take some time.
Setting the working directory as the reference point could be a good choice, but this implies taking all relative paths and relativize them to the working directory trimming or adding things like "..\" and named partial paths in the head, if you want to stay with the interpretation I gave to relative local includes.
Anyways, the trick for me now is to relativize the paths to the working dir. this way in the code:
#ifdef __POCC__
#include "lib\mylib\header.h"
#else
#include "..\lib\mylib\header.h"
#endif
This fools both the IDE and the compiler pretty well.
Strictly regarding the IDE: the CD <subdir> "hack" partially does the trick (without using #ifdefs) modifying the object properties in this way:
cd src
$(CC) $(CCFLAGS) "$!" -Fo"$@"
cd ..
Note you need CD.. after compilation to avoid linking issues.
I've attached a workspace which presents 2 problematic cases (projects local3 and local4) and 2 "normal" situations.
I'm very glad you're taking this subject into account. Thanks again!