E.g, I've got a header file called 1.h:
#define MY 3
Then I have a subdirectory called myc and 1.c and f.c files:
$ cat 1.c
void f();
int main()
{
return 0;
}
$ cat f.c
#include"../1.h"
#include<stdio.h>
void f(){printf("hello %d\n",MY);}
$ cat SConscript
Program('my2files',['1.c','f.c'])
Run scons, OK.Then I changed 1.h to be
#define MY 2
I didn't specify CPPPATH=../ in my SConstruct, so I expect that scons could detect this dependency. I run scons again, well, seems to detected this change and .c files were compiled again.
My question is, is CPPPATH implicitly usedless? Is it scons or gcc that could detect header file changes?
As per SCons documentation, it seems automatically added by SCons only
Like the $LIBPATH variable, the $CPPPATH variable may be a list of directories, or a string separated by the system-specific path separation character (':' on POSIX/Linux, ';' on Windows). Either way, SCons creates the right command-line options so that the following example:
Program('hello.c', CPPPATH = ['include', '/home/project/inc'])
Scons CPPPATH DOC