简体   繁体   中英

Scons doen't specify CPPPATH, could still detect .h dependency?

Eg, I've got a header file called 1.h:

#define MY 3

Then I have a subdirectory called myc and 1.c and fc 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM